Time of Update: 2016-07-25
$users = array( array('name' => 'tom', 'age' => 20) , array('name' => 'anny', 'age' => 18) , array('name' => 'jack', 'age' =>
Time of Update: 2016-07-25
/*** Socket版本* 使用方法:* $post_string = "app=socket&version=beta";* request_by_socket('www.1bo8.cn','/restServer.php',$post_string);*/function request_by_socket($remote_server,$remote_path,$post_string,$port = 80,$timeout = 30){ $socket = fsockopen($
Time of Update: 2016-07-25
$params = array('host' => 'localhost', 'port' => '25', 'username' => 'test@jbxue.com', 'password' => 'test'); //$to = $test_mail; $recipients = $to; 接收人,可以是一個數組來存放多個地址 $headers['From'] = $email;
Time of Update: 2016-07-25
phpmailer 發送郵件類庫 header('Content-Type: text/html; charset=utf-8');require("phpmailer/class.
Time of Update: 2016-07-25
empty 和 isset 雖然都是變數處理函數,它們都用來判斷變數是否已經配置,它們卻是有一定的區別:empty還會檢測變數是否為空白、為零。當一個變數值為0,empty 認為這個變數同等於空,即相當於沒有設定。 /*比如檢測 $id 變數,當 $id=0 時,用empty 和 isset 來檢測變數 $id 是否已經配置,兩都將返回不同的值—— empty
Time of Update: 2016-07-25
貌似記得以前傳過一個,是我自己寫的,今天這個是網上的,來自:http://www.cnblogs.com/zcy_soft/archive/2010/12/13/1904791.html
Time of Update: 2016-07-25
PHP擷取漢字拼音首字母函數 轉自www.54dev.com /** * @param unknown_type $str * @return 取得漢字的首字母 */function getfirstchar($str){ $fchar=$str[0]; //判斷是否為字串 if(ord($fchar)-->=ord("A") && ord($fchar)
Time of Update: 2016-07-25
函數解析 /** * @desc 轉換成位元組數 * 注意它case的用法,由於沒有寫break;所以可以實現一個優雅的換算公式 * 但是 如果順序換了就完蛋了 * @author wangjiafang * @since 2010.12.22 * @param string * @return string */function
Time of Update: 2016-07-25
.PHP產生靜態html檔案的方法 1,下面使用模版的一個方法! $fp = fopen ("templets.html","a"); if ($fp){ $fup = fread ($fp,filesize("templets.html")); $fp2 = fopen ("html.shtml","w"); if ($fwrite ($fp2,$fup)){
Time of Update: 2016-07-25
#!/usr/bin/php -q$file = "/var/www/".date('H').'_'.date('i').'_'.date('s').'.txt';file_put_contents($file,date('Y-m-d'));?> 複製代碼然後 chmod +x test.php 賦予test.php 可執行檔許可權。3、 命令 crontab -e*/1 * * * * /var/www/test.php每分鐘執行test.php4、/etc/init.d/cron
Time of Update: 2016-07-25
[code]totalpage=$objpage; } //設定當前頁 function setCurrentpage($objpage=1){ $this->currentpage=$objpage; } //設定跨度 function setStride($objStride=1){ $this->stride=$objStride; }//獲得總頁數 function getTotalpage(){ return
Time of Update: 2016-07-25
首先,來看array->xml。$value) {首先,來看array->xml。 function ia2xml($array) { $xml=""; foreach ($array as $key=>$value) { if (is_array($value)) { $xml.="".ia2xml($value).""; } else {
Time of Update: 2016-07-25
/* $cache = new Cache("../cache/",20); // 建構函式,建立緩衝類對象$cache->PutCache(); // 倒出緩衝*/class Cache{private $CacheDir = ’Cache’; /* 緩衝目錄 */private $SetTimeOut = 10; /* 緩衝到期時間 */private $SetExt = ’.cache’; /* 快取檔案尾碼名 */private $CacheFileUrl = ’’; /*
Time of Update: 2016-07-25
張映男28tank男28複製代碼1)DOMDocument讀取xml $doc = new DOMDocument();$doc->load('person.xml'); //讀取xml檔案$humans = $doc->getElementsByTagName_r( "humans" ); //取得humans標籤的對象數組foreach( $humans as $human ){$names = $human->getElementsByTagName_r( "name" );
Time of Update: 2016-07-25
範例程式碼:require('libs/Smarty.class.php');$tpl=new Smarty();$tpl->template_dir='./templates/';$tpl->compile_dir='./templates_c';$tpl->config_di範例程式碼:require('libs/Smarty.class.php');$tpl=new Smarty();$tpl->template_dir='./templates/';$tpl->compile_dir='
Time of Update: 2016-07-25
一、Smarty緩衝的配置$smarty->cache_dir = "/caches/"; //緩衝目錄$smarty->caching = true; //開啟緩衝,為flase的時侯快取無效判定$smarty->cache_lifetime = 60; //緩一、Smarty緩衝的配置$smarty->cache_dir = "/caches/"; //緩衝目錄$smarty->caching = true;
Time of Update: 2016-07-25
$conn= new PDO("mysql:dbname=lamp;host=localhost","root","123456");$sql="select id,username,phone,*** from
Time of Update: 2016-07-25
$s='{"webname":"homehf","url":"www.homehf.com","qq":"744348666"}';$web=json_decode($s); //將字元轉成JSON$arr=array();foreach($web as $k=>$w) $arr[$k]=$w;前三行可以用$web=json_decode($s,true)代替;print_r($arr);?>
Time of Update: 2016-07-25
@session_start();require_once("smarty.php");//載入smarty模板類require_once("adodb/adodb.inc.php");//載入adodb資料庫//串連資料庫$dbhost = 'localhost'; // 資料庫伺服器$dbuser = 'root'; // 資料庫使用者名稱$dbpwd= 'root'; // 資料庫密碼$dbname='hejia'; //資料庫名稱$conn =
Time of Update: 2016-07-25
//第一步 建立解析器 xml_parser_create(編碼);$xml = xml_parser_create('utf-8');//xml_parser_set_option — 為指定 XML 解析進行選項設定//xml_parser_set_option($xml,XML_OPTION_CASE_FOLDING,false);