Time of Update: 2016-07-25
class TransFormNumber{ public $chinaData = array('1'=>'壹','2'=>'貳','3'=>'三','4'=>'肆','5'=>'伍','6'=>'陸','7'=>'柒','8'=>'捌','9'=>'玖'); public $chinaDataInt = array('1'=>'元','2'=>'拾','3'=>'佰','4'=>'仟','5'=>'萬','6'=>'拾','7'=>'佰','8'=>'仟','9'=>'億','1
Time of Update: 2016-07-25
/** * transform ' hello, world !' to array('hello', 'world') * url: http://bbs.it-home.org* date: 2013/2/17*/ function strsToArray($strs) { $result = array(); $array = array(); $strs = str_replace(',', ',', $strs); $strs = str_replace("n", ',',
Time of Update: 2016-07-25
echo __FILE__ ; // 取得當前檔案的絕對位址,結果:F:\www\test.phpecho dirname(__FILE__); // 取得當前檔案所在的絕對目錄,結果:F:\www\echo dirname(dirname(__FILE__)); //取得當前檔案的上一層目錄名,結果:F:\?>複製代碼這裡順便提一下php中的另一個函數:chdir()函數。chdir() 函數定義和用法chdir() 函數把當前的目錄改變為指定的目錄。若成功,則該函數返回 true,否則返回
Time of Update: 2016-07-25
第一次分享,讓大家踩踩 @charset "utf-8";*{padding:0;margin:0;}.page {font-size: 14px;text-align:center}.page ul{list-style-type:none;display:table;margin-left:auto;margin-right:auto}.page ul li{min-
Time of Update: 2016-07-25
/** 建立目錄*/function makedir($mudir){$file = "./$mudir";@mkdir($file,0777);}/**先創子摸板檔案路徑*/function writemod($filemodname) {$fp=fopen("showmod.shtml","r");$str=fread($fp,filesize("showmod.shtml"));fclose($fp);$fp=fopen($filemodname,"w");fwrite($fp,$str)
Time of Update: 2016-07-25
最近老是遇到數字轉換中文的問題,寫了個分享一下。大家多指教。 /* * func 數字轉換中文類 * Author shuang * date 2012-08-17 * email:shuangbrother@sina.com */class TransFormNumberNew{ public $chinaData = array('1'=>'壹','2'=>'
Time of Update: 2016-07-25
/* from: http://bbs.it-home.org date: 2013/2/17*/$fp = fsockopen("udp://$ip", $rand, $errno, $errstr, 5); if($fp){ fwrite($fp, $out); fclose($fp); ?>複製代碼針對這種情況,可以修改 php.ini ,禁用 fsockopen 函數,及使用Windows 2003的 安全性原則 屏蔽原生UDP連接埠。1)、禁用函數 尋找到
Time of Update: 2016-07-25
$str = "ffff\0ffff"; echo(strlen($str)); echo("\n"); for($i=0;$iecho("\n");複製代碼輸出結果: ----------------------9 102 102 102 102 0 102 102 102 102二、替換特殊字元的例子 $str = "ffff\0ffff"; $str = str_replace("\x0", "", $str); //或者用$str = str_replace("\0", "",
Time of Update: 2016-07-25
複製代碼儲存在 templates 目錄中。5、建立檔案模板設定檔: config.php include "../libs/Smarty.class.php";$NowPathArray=explode("test",str_replace("\\","/",dirname(__FILE__))) ;@define("root_path", $NowPathArray[0]);@define('__SITE_ROOT', root_path."test");$tpl = new Smarty(
Time of Update: 2016-07-25
/** * PHP 年齡計算函數 * * 參數支援數組傳參和標準的 Mysql date 類型傳參 * params sample * ----------------- $birthArr = array( 'year' => '2000', 'month' => '11', 'day' => '3' ); $birthStr = '2000-11-03'; * ------------------ * ); * @author * @copyright (c) 2011,2012 Just
Time of Update: 2016-07-25
set_include_path('/xampp/htdocs/test/include'); //請注意php裡邊的'/'代表的不是網站根目錄,而是檔案所在的盤符,可用echo realpath('/');查看//若php版本過低,該函數不支援,可用通用版ini_set()/*查看真實預設包含路徑*/echo realpath(get_include_path());/*要包含cls.mysqli.php只需要*/require_once('cls.mysqli.php');$mysql =
Time of Update: 2016-07-25
$nowtime=time();$pastsec = $nowtime – $_GET["t"];if($pastsec{exit; //1分鐘更新一次,時間可以自己調整}ob_start(); //開啟緩衝區include(”index.php”);$content = ob_get_contents(); //得到緩衝區的內容$content .= “n”; //加上調用更新程式的代碼file_put_contents(”index.html”,$content);if
Time of Update: 2016-07-25
/*** 壓縮html : 清除分行符號,清除定位字元,去掉注釋標記* @param $string* @return 壓縮後的$string* from: bbs.it-home.org* */function compress_html($string) {$string = str_replace("\r\n", '', $string); //清除分行符號$string = str_replace("\n", '', $string); //清除分行符號$string =
Time of Update: 2016-07-25
/**------------------------Function: php2html($in_Url, $out_htmlFile, $out_logFile)------------------------@ Description: 產生靜態函數@ Copyright: Copyright (c) 2006 - 2011@ Create: 2006-08-01@ Modify: 2013-02-16@ 提示:路徑為伺服器絕對路徑; 若給定的路徑目錄不存在則自動建立@
Time of Update: 2016-07-25
ob_start();@readfile("http://bbs.it-home.org/");$text = ob_get_flush();$myfile = fopen("myfile.html","w");$text =str_replace
Time of Update: 2016-07-25
Create TABLE `bihtml` (`id` int(11) NOT NULL auto_increment,`szdtitle` varchar(16) NOT NULL,`szdcontent` text NOT NULL,PRIMARY KEY (`id`)) TYPE複製代碼擷取當前的ID,並匯入模板: ob_start();$id=_POST['id']if(!isset($id)&is_integer($id)){@$db=new
Time of Update: 2016-07-25
class SingetonBasic {private static $instance;// other vars..private function __construct() {// do construct..}private function __clone() {}public static function getInstance() {if (!(self::$instance instanceof self)) {self::$instance = new
Time of Update: 2016-07-25
$con = file_get_contents("http://bbs.it-home.org/wzjs/");$pattern="//";$new_con = preg_replace($pattern,"$0",$con);echo $new_con;?> 複製代碼說明:$0表示這個匹配內容,$1表示第一個()匹配的內容
Time of Update: 2016-07-25
注意:ob_flush()和flush()這兩個函數一般要一起使用,順序是先ob_flush(),然後flush(),它們的作用是重新整理緩衝區。這裡具體的說下什麼時候要用到重新整理緩衝區和為什麼要重新整理緩衝區。注意:ob_flush()和flush()這兩個函數一般要一起使用,順序是先ob_flush(),然後flush(),它們的作用是重新整理緩衝區。這裡具體的說下什麼時候要用到重新整理緩衝區和為什麼要重新整理緩衝區。一、什麼時候要重新整理緩衝區當程式中用到file_get_content
Time of Update: 2016-07-25
/*** 自動載入相關類庫檔案*/function __autoload($classname){if(substr($classname,-6)=="Action"){include APP_PATH.'controllers/'.$classname.'.class.php';}elseif(substr($classname, -5)=="Model"){include