Time of Update: 2016-07-13
錯誤: Warning: fopen() [function.fopen]: Unable to find the wrapper "https" - did you forget to enable it when you configured
Time of Update: 2016-07-13
如:時間剛好是5分鐘前,則對應的時間戳記就會被格式化為5分鐘前,不多說了,直接貼上代碼: 複製代碼 代碼如下: /** * 格式化時間 * @param integer $timestamp 時間戳記 * @param string $format dt=日期時間 d=日期 t=時間 u=個人化 其他=自訂 * @param integer $timeoffset 時區值 * @param string $custom_format 自訂時間格式 * @return string */
Time of Update: 2016-07-13
1 到 http://xdebug.org/download.php下載xdebug。注意找到自己對應的php版本。或者可以通過 http://xdebug.org/wizard.php頁面,將phpinfo的資訊複製進去,點最下面的分析。它會告訴你要下載哪個版本,然後如何配置。 2.開啟php.ini添加以下語句 複製代碼 代碼如下:[XDEBUG]zend_extension = "D:\Program Files
Time of Update: 2016-07-13
當你在發送郵件時,你或許很想知道該郵件是否被對方已閱讀。這裡有段非常有趣的程式碼片段能夠顯示對方IP地址記錄閱讀的實際日期和時間。 複製代碼 代碼如下: error_reporting(0); Header("Content-Type: image/jpeg"); //Get IP if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_
Time of Update: 2016-07-13
複製代碼 代碼如下:$urlcon= 'http://localhost/******.php';$data=' {"button":[{ "type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手簡介","key":"V1001_TODAY_SINGER"},{"name":"菜單","sub_button":[{"type":"click","name":"hello
Time of Update: 2016-07-13
由於公司需要php方面的項目開發,php剛剛入門,在寫按鈕提交過程中,asp.net裡的按鈕事件更好些。先看下面的代碼,複製代碼 代碼如下:require_once '../inc/EventHelper.php';function Page_Load(){ echo '在任何時候都會運行'; if(!Page::IsPostBack()) { echo '載入產品分類'; if($_GET['cmd']=='edit') {
Time of Update: 2016-07-13
PHP PDO Access連結複製代碼 代碼如下:class DbHelpClass { private $conn; private $qxId; private $ret; function __construct() { $path="../../App_Data/sd#f#45G_!.mdb"; $constr="DRIVER={Microsoft Access
Time of Update: 2016-07-13
1、 {} 表示程式塊的開始和結束例如 複製代碼 代碼如下:if ($x==$y) { do_nothing(); } 2、 {}用來表示字串下標例如 (引用longnetpro兄弟的話) $s{1}表示字串$s的第2個位元組(不是第一個),基本等同於$s[1],只不過後者是老的寫法,PHP手冊推薦第一種寫法 www.444p.com著作權 3、分離變數例如 複製代碼 代碼如下:$s = "Di, "; echo ("${s}omething"); //Output: Di,
Time of Update: 2016-07-13
1. echo函數:輸出函數,是命令,不能傳回值。echo後面可以跟很多個參數,之間用分號隔開,如: echo $myvar1; echo 1,2,$myvar,"bold";2. print函數:是函數,可以返回一個值,只能有一個參數。int print ( string arg )Outputs arg . Returns 1 , always.3. printf函數:int printf ( string format [, mixed args [, mixed ...]]
Time of Update: 2016-07-13
Definition and Usage定義和用法The strnatcmp() function compares two strings using a "natural" algorithm.strnatcmp()函數的作用是:用自然運演算法則比較字串(大小寫敏感)。In a natural algorithm, the number 2 is less than the number 10. In computer sorting, 10 is less than 2, because
Time of Update: 2016-07-13
複製代碼 代碼如下:#!/usr/local/bin/php.clirequire_once './lib/swift_required.php';//MySQL$mysql_dbname = "db";$mysql_user = "user";$mysql_pass = "pass";$mysql_file = "./xxx.sql";$mysql_charset = "utf8";system("mysqldump
Time of Update: 2016-07-13
例1複製代碼 代碼如下:php函數指定預設值-www.jbxue.comfunction printMe($param = NULL){ print $param;}printMe("This is test");printMe();?>輸出結果:This is test例2 php函數參數預設值的使用範例,php函數參數中設定和使用預設值。複製代碼 代碼如下: php函數參數預設值 - www.jbxue.com function textonweb
Time of Update: 2016-07-13
第一段是讀檔案,下載。第二段是字串下載。複製代碼 代碼如下:$fileName = "prefs.csv";header('Content-Type: application/octet-stream');header('Content-Disposition: attachment; filename=' . $fileName);header('Content-Transfer-Encoding: binary');header('Content-Length: ' . filesize($
Time of Update: 2016-07-13
複製代碼 代碼如下: define(CHARSET, 'UTF-8'); // 系統預設編碼 /** * 根據中文裁減字串 * @param $string - 字串 * @param $length - 長度 * @param $doc - 縮減尾碼 * @return 返回帶省略符號被裁減好的字串 */ function cutstr( $string, $length, $dot = '...' ) { if ( strlen( $string ) return $string; }
Time of Update: 2016-07-13
方法一:複製代碼 代碼如下:echo "";方法二:複製代碼 代碼如下:echo ';';裡面的location.href="index.htm"表示你點擊訊息框的確定按鈕後將要轉向的頁面。如果不用去掉就可!http://www.bkjia.com/PHPjc/621683.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/621683.htmlTechArticle方法一: 複製代碼 代碼如下: echo "scriptalert('提示內容')/
Time of Update: 2016-07-13
代碼:複製代碼 代碼如下:eval("echo'hello world';");上邊代碼等同於下邊的代碼:echo"hello world";在瀏覽器中都輸出:hello world運用eval()要注意幾點:1.eval函數的參數的字串末尾一定要有分號,在最後還要另加一個分號(這個分號是php限制)2.注意單引號,雙引號和反斜線的運用。如果參數中帶有變數時,並且變數有賦值操作的話,變數前的$符號錢一定要有\來轉義。如果沒有賦值操作可以不需要。代碼:複製代碼 代碼如下:$a=100;eval("
Time of Update: 2016-07-13
複製代碼 代碼如下: /** * 檢測使用者當前瀏覽器 * @return boolean 是否ie瀏覽器 */ function chk_ie_browser() { $userbrowser = $_SERVER['HTTP_USER_AGENT']; if ( preg_match( '/MSIE/i', $userbrowser ) ) { $usingie = true; } else { $usingie = false; } return $usingie; }
Time of Update: 2016-07-13
Smarty是非常流行的模板系統,它分離了業務和邏輯、執行速度快,在php網站中有廣泛的運用。不過在部署到sina app engine(sae)上時出現了問題,因為sae作為雲端運算平台式無法進行檔案讀寫操作的,所以Smarty中輸出的快取檔案就無法實現。錯誤資訊:“SAE_Fatal_error: Uncaught exception 'SmartyException' with message 'unable to write file ./web/templates_c/wrt4e955
Time of Update: 2016-07-13
今天因為程式裡面要把寫入資料庫的html原始碼以html源編碼的形式顯示在頁面裡面,而不要被瀏覽器解釋成。。找了N久都不知道怎麼做後來看了一下一個程式裡面有修改模板的功能。。找了一個竟然是一個asp的方法^^記下來了Server.HTMLEncodeHTMLEncode一.HTMLEncode 方法對指定的字串應用 HTML 編碼。文法Server.HTMLEncode( string )參數string 指定要編碼的字串。 樣本指令碼複製代碼 代碼如下:") %>輸出The
Time of Update: 2016-07-13
使用DOM,你可以輕鬆從任何頁面上抓取連結,程式碼範例如下: 複製代碼 代碼如下: $html = file_get_contents('http://www.example.com'); $dom = new DOMDocument(); @$dom->loadHTML($html); // grab all the on the page $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a"); for