예제 #1
0
파일: trash.php 프로젝트: rigidus/ea
 function restore($log_id, $files_dir = false)
 {
     zipfile::read(SYS_ROOT . 'var/trash/' . $log_id . '_conf.zip');
     zipfile::extract(SYS_ROOT . 'conf/');
     if ($files_dir) {
         zipfile::read(SYS_ROOT . 'var/trash/' . $log_id . '_files.zip');
         zipfile::extract($files_dir);
     }
     dump::restore(SYS_ROOT . 'var/trash/' . $log_id . '_base.zip');
 }
예제 #2
0
$arrPush[] = 5;
dump::pf($arrPush);
//Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )
//----------------------------------------------------------------------------------------------------
//Remove elementos no FIM do array
$arrPop = [11, 12, 13];
$removido = array_pop($arrPop);
dump::pf($arrPop);
//Array ( [0] => 11 [1] => 12 )
dump::df($removido);
//int 13
//----------------------------------------------------------------------------------------------------
$arr01 = array();
$arr02 = array(1 => "data");
//Reescreve os indices
$arr03 = array_merge($arr01, $arr02);
dump::pf($arr03);
//Array ( [0] => data )
$arr01 = array(3 => 'texto');
$arr02 = array(1 => "data");
//Reescreve os indices de forma numerica (ASC)
$arr03 = array_merge($arr01, $arr02);
dump::pf($arr03);
//Array ( [0] => texto [1] => data )
$arr01 = array('a1' => 'texto');
$arr02 = array('a1' => "data");
//Como a chave é "string", admite o segundo valor
$arr03 = array_merge($arr01, $arr02);
dump::pf($arr03);
//Array ( [a1] => data )
//----------------------------------------------------------------------------------------------------
<?php

include '../oop/dump.php';
dump::d(metaphone("boatrace"));
dump::d(metaphone("bowtrace"), 1);
dump::d(soundex("boatrace"));
dump::d(soundex("bowtrace"), 1);
예제 #4
0
$stuffid = $_POST["stuffid"];
// 树种
$kindid = $_POST["kindid"];
// 货种
$productlen = $_POST["productlen"];
// 长度
$spotpositionid = $_POST["spotpositionid"];
// 位置
$train = $_POST["train"];
//列号
$trainDate = $_POST["trainDate"];
//列到货日期
// error_log(date('Y-m-d H:i:s') .'spotpositionid='.$spotpositionid."\n",3,$_SERVER['DOCUMENT_ROOT']."/log/run.log");
$userphone = $_SESSION['phone'];
// 操作员手机
$dump = new dump($carnum, $spotpositionid, $portid, $userid, $userphone);
$dump->kindid = $kindid;
$dump->stuffid = $stuffid;
$dump->productlen = chageEmptyStr($productlen);
$dump->contactphone = $contactphone;
$dump->train = $train;
$dump->trainDate = $trainDate;
//error_log(date('Y-m-d H:i:s') .'ok=1'."\n",3,$_SERVER['DOCUMENT_ROOT']."/log/run.log");
$result = $dump->operationRecord();
//error_log(date('Y-m-d H:i:s') .'ok=0'.$result."\n",3,$_SERVER['DOCUMENT_ROOT']."/log/run.log");
// $updateresult=array();
if ($result) {
    if ($dump->isnew) {
        $caption = "发布";
    } else {
        $caption = "更新";
예제 #5
0
<?php

include '../oop/dump.php';
$string = 'ricardo.a...mendes';
dump::d(explode(".", $string));
/*
array (size=5)
  0 => string 'ricardo' (length=7)
  1 => string 'a' (length=1)
  2 => string '' (length=0)
  3 => string '' (length=0)
  4 => string 'mendes' (length=6)
*/
//dump::d(explode("", $string)); //Warning: explode(): Empty delimiter in
$array = ['Ricardo', 'a', 'Mendes'];
dump::d(implode("-", $array));
//string 'Ricardo-a-Mendes'
예제 #6
0
파일: dump.php 프로젝트: rigidus/ea
 function read_str($fp)
 {
     $string = '';
     self::$file_cache = ltrim(self::$file_cache);
     $pos = strpos(self::$file_cache, "\n", 0);
     if ($pos < 1) {
         while (!$string && ($str = self::read($fp))) {
             $pos = strpos($str, "\n", 0);
             if ($pos === false) {
                 self::$file_cache .= $str;
             } else {
                 $string = self::$file_cache . substr($str, 0, $pos);
                 self::$file_cache = substr($str, $pos + 1);
             }
         }
         if (!$str) {
             if (self::$file_cache) {
                 $string = self::$file_cache;
                 self::$file_cache = '';
                 return trim($string);
             }
             return false;
         }
     } else {
         $string = substr(self::$file_cache, 0, $pos);
         self::$file_cache = substr(self::$file_cache, $pos + 1);
     }
     return trim($string);
 }
예제 #7
0
<?php

require '../oop/dump.php';
$string = "abcdefg";
//2o. param positivo => quantidade de caracteres apos 1o. param
dump::d(substr($string, 3, 2));
//string 'de'
//2o. param negativo => indica qual sera a posicao final do fim para o inicio
dump::d(substr($string, 2, -2));
//string 'cde'
dump::d(substr($string, -3, -2));
//string 'e'
dump::d(substr($string, -3, 20));
//string 'efg' (length=3)
dump::d(substr($string, -3, -4));
//string '' (length=0)
예제 #8
0
<?php

include '../oop/dump.php';
dump::d(strlen("abc"));
//int 3
dump::d(strlen("abc\n"));
//int 4
dump::d(strlen('abc\\n'), 1);
//int 5
dump::d(str_word_count("Ola ricardo"));
dump::d(str_word_count("Ola ricardo", true));
dump::d(str_word_count("Ola ricardo ricardo", true));
dump::d($saida3);
//int 1
dump::d($matches, 1);
/*
array (size=1)
  0 => string 'ricardo' (length=7)
*/
$saida4 = preg_match_all($expressao, $stringMatchAll, $matches);
dump::d($saida3);
//int 1
dump::d($matches, 1);
/*
array (size=1)
  0 =>
    array (size=2)
      0 => string 'ricardo' (length=7)
      1 => string 'ricardo' (length=7)
*/
//////////////////////////////////////////////////////////////////////////////
/**
 * preg_replace
 */
$nome = 'Marcos';
$saidaReplce01 = preg_replace($expressao, $nome, $stringMatchAll, -1, $count);
dump::d($saidaReplce01);
//string 'Marcos_mendes_Marcos' (length=20)
dump::d($count, 1);
//int 2
$saidaReplce02 = preg_replace('/(ricardo)_(mendes)/', '\\2, \\1', $stringMatch);
dump::d($saidaReplce02);
//string 'mendes, ricardo' (length=15)
예제 #10
0
파일: base.module.php 프로젝트: rigidus/ea
 function reserve()
 {
     $date = date('Y_m_d__H_i_s');
     dump::backup(SYS_ROOT . 'var/backup/' . $date . '.zip');
     headers::self();
 }