explode() 函數把字串分割為數組。文法explode(separator,string,limit)例子一 代碼如下複製代碼 <?php$test='472347127,893372115,850965403';$r=explode(",",$test);for($i=0;$i<sizeof($r);$i++){ echo $i.".". $r[$i].""; }?> 輸出: 0.4723
1.header()函數header()函數是PHP中進行頁面跳轉的一種十分簡單的方法。header()函數的主要功能是將HTTP協議標題(header)輸出到瀏覽器。header()函數的定義如下:void header (string string [,bool replace [,int
淘寶和百度的介面,百度: “suggestion.baidu.com/su?wd= 搜尋內容 &p=3&t=1273278850500”淘寶: “ suggest.taobao.com/sug?code=utf-8&callback=?&q=搜尋內容”下面看百度例子 代碼如下複製代碼 $abcs = mb_convert_encoding(trim($_POST["key"])
例子public function del(){ header("Content-Type: text/html; charset=UTF-8"); echo '點擊檔案名稱可以查看:<br>'; $dir =getcwd()."/html/";
代碼如下複製代碼 <?php //以程式登陸一個論壇登入狀態例function bbslogin($user_login, $password, $host, $port = "80") { //需要提交的post資料 $argv = array('cookie' => array('user_login' => $user_login,
將二維碼與產品的id合并成一張圖。。。我的步驟是先把產生一張圖,把產品的id放進去。。。然後再把二維碼的圖片與產生的圖片合并。。。說合并其實就是把二維碼貼到產生的圖上面。。。具體代碼如下 代碼如下複製代碼 $width=310; //布畫寬度$height=360; //布畫高度$im =
PHP的資料庫的ODBC的ODBC是一種應用編程介面( API ) ,允許您串連到一個資料來源(如MS Access資料庫) 。 -------------------------------------------------- ------------------------------ 建立一個ODBC串連 由於ODBC串連,可以串連到任何資料庫,在任何電腦上,在您的網路,只要一個ODBC串連可用。 以下是如何建立ODBC串連到MS Access資料庫: 開啟管理工具表徵圖在您的控制台。
se.php 代碼如下複製代碼 <?php$city = $_GET['city'];$data = createXml($city); $xml = simplexml_load_string($data);header("Content-type: text/xml");echo $xml->asXML(); // 產生XML資料function createXml($city){ /
在 PHP 應用中,Regex主要用於:•正則匹配:根據Regex匹配相應的內容•正則替換:根據Regex匹配內容並替換•正則分割:根據Regex分割字串常用preg_match_all()preg_match_all() 函數用於進行Regex全域匹配,成功返回整個模式比對的次數(可能為零),如果出錯返回 FALSE 。文法:int preg_match_all( string pattern, string subject, array matches [,
PHP的顯示時間的代碼比ASP還是強大多了,調用起來更加的簡單。先看 代碼如下複製代碼 //系統函數開始$nbyear=Date('Y');$nbmonth=Date('m');$nbday=Date('d');$date=Date('Y-m-d');$datetime=Date('Y-m-d H:i:s');$cndate=Date('Y年m月d日');$cndateweek=Date('Y年m月d日'); 下面我們來一一介紹1、年-月-日echo
代碼如下: 代碼如下複製代碼 function get_between($input, $start, $end) { $substr = substr($input, strlen($start)+strpos($input, $start), (strlen($input) - strpos($input, $end))*(-1)); return
一,關閉notice錯誤提示1、在php.ini檔案中改動error_reporting改為: 代碼如下複製代碼 error_reporting=E_ALL & ~E_NOTICE 2、如果你不能操作php.ini檔案,你可以使用如下方法在你想禁止notice錯誤提示的頁面中加入如下代碼: 代碼如下複製代碼 error_reporting(E_ALL^E_NOTICE);
//迴圈刪除目錄和檔案函數 代碼如下複製代碼 function delDirAndFile( $dirName ){if ( $handle = opendir( “$dirName” ) ) {while ( false !== ( $item = readdir( $handle ) ) ) {if ( $item != “.” && $item != “..” ) {if ( is_
代碼如下複製代碼 <?php//需要替換的關鍵字$GLOBALS["patterns"] = array( "/#BASE_URL#/");//替換後的內容,和上面的匹配規則一一對應$GLOBALS["replacements"] = array(
我們先來看看microtime 和 memory_get_usage函數用法吧義和用法microtime() 函數返回當前 Unix 時間戳記和微秒數。文法microtime(get_as_float)參數 描述 get_as_float 如果給出了 get_as_float 參數並且其值等價於 TRUE,該函數將返回一個浮點數。例子 代碼如下複製代碼 <?phpecho(microtime());?> 輸出:0.25139300
產生短網址程式 代碼如下複製代碼 <?phpfunction code62($x){ $show=''; while($x>0){ $s=$x % 62; if ($s>35){ $s=chr($s+61); }elseif($s>9&&$s<=35){ $s=chr($s+55
具體代碼 代碼如下複製代碼 <?php class runtime{ var $StartTime = 0; var $StopTime = 0; function get_microtime() { list($usec,
首先是 Ajax.php檔案:這個檔案我覺著就是接收資料處理資料的 代碼如下複製代碼 <?phpmysql_connect("localhost","root","");mysql_select_db("aaa");mysql_query("set names 'UTF8'"); 上面的這些代碼 不用我說都知道是串連資料庫的 代碼如下複製代碼
1.php中時間轉換函式 代碼如下複製代碼 strtotime(date())date("Y-m-d H:i",$unixtime) 2.php中獲得今天零點的時間戳記要獲得零點的unix時間戳記,可以使用$todaytime=strtotime(“today”),然後再使用date("Y-m-d H:i",$todaytime)轉換為日期。時間戳記轉換為日期
$link = mssql_connect("localhost", "sa", "sa") or die("不能聯連上mssql 伺服器"); mssql_select_db("test", $link) or die("資料庫連接失敗"); //建立mssql查詢語句