Time of Update: 2016-07-25
$conn=mssql_connect("127.0.0.1","user","passwd");mssql_select_db("mydb");$stmt=mssql_init("pr_name",$conn);//$a=50001;mssql_bind($stmt,"RETVAL",$val,SQLVARCHAR); //用於直接返回return
Time of Update: 2016-07-25
require_once('snoopy.class.php');//http://www.abc.com/bdp.php?shareid=29160&uk=2855065916$url = 'http://pan.baidu.com/share/link?shareid=' . $_GET['shareid'] . '&uk=' . $_GET['uk'];$snoopy = new Snoopy();$snoopy -> read_timeout = 0;$snoopy -> fetch($
Time of Update: 2016-07-25
function RecordToJson($recordset){$jstr='[';while($rs = $recordset->Fetch()){//$nick = iconv("GBK",'utf-8',$rs['nick']);/*轉換為utf-8編碼*///TODO:遍曆結果集$arr_keys=array_keys($rs);$jstr=$jstr.'{';for($i=0;$i{//資料庫編碼為gbk,需要轉換編碼//TODO;iconv("GBK",'utf-8',$rs['
Time of Update: 2016-07-25
/*************************說明:判斷傳遞的變數中是否含有非法字元如$_POST、$_GET功能:防注入**************************///要過濾的非法字元$ArrFiltrate=array("'",";","union");//出錯後要跳轉的url,不填則預設前一頁$StrGoUrl="";//是否存在數組中的值function FunStringExist($StrFiltrate,$ArrFiltrate){foreach
Time of Update: 2016-07-25
#建立指定範圍資料表#auther: 小強#date: 2008-03-31create table randnumberselect -1 as numberunionselect -2unionselect -3unionselect -4unionselect -5unionselect 0unionselect 1unionselect 2unionselect 3unionselect 4unionselect 5#得到隨機數#auther: 小強(占卜師)#date: 2008-03
Time of Update: 2016-07-25
PHPMailer 中文使用說明,有需要的朋友拿去咯。A開頭:$AltBody --屬性出自:PHPMailer : $AltBody檔案:class.phpmailer .php說明:該屬性的設定是在郵件內文不支援HTML的備用顯示AddAddress --方法出自:PHPMailer ::AddAddress(),檔案:class.phpmailer .php說明:增加收件者。參數1為收件者郵箱,參數2為收件者稱呼。例AddAddress("to@163.com","to
Time of Update: 2016-07-25
class Bar{public function test() {$this->testPrivate();$this->testPublic();}public function testPublic() {echo "Bar::testPublic\n";}private function testPrivate() {echo "Bar::testPrivate\n";}}class Foo extends Bar{public function testPublic() {echo "
Time of Update: 2016-07-25
在nginx與php的環境中,配置了一個wordpress,訪問時發現php的頁面一直顯示空白,起初以為是許可權問題,將許可權改成755後還是不行。然後,開啟nginx和php的日誌,但在日誌裡也沒有發現有價值的錯誤。繼續嘗試更改php的日誌,依然無果。最後發現是nginx的設定檔裡面少寫了一條配置資訊:fastcgi_param SCRIPT_FILENAME
Time of Update: 2016-07-25
fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name;fastcgi_param QUERY_STRING $query_string;複製代碼Parameter SCRIPT_FILENAME is used by PHP for determining the name of script to execute, and QUERY_STRING contains the parameters of
Time of Update: 2016-07-25
location ~ .php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include
Time of Update: 2016-07-25
php的程式在firefox訪問時提示:內容編碼錯誤 無法顯示您嘗試查看的頁面,因為它使用了無效或者不支援的壓縮格式。php的程式在firefox訪問時提示:內容編碼錯誤
Time of Update: 2016-07-25
本文介紹的內容是我對外掛程式機制的理解,及其在PHP中的實現,此方案僅是外掛程式機制的實現方法之一,僅供參考。本文介紹的內容是我對外掛程式機制的理解,及其在PHP中的實現,此方案僅是外掛程式機制的實現方法之一,僅供參考。外掛程式,亦即Plug-in,是指一類特定的功能模組(通常由第三方開發人員實現),它的特點是:當你需要它的時候啟用它,不需要它的時候禁用/刪除它;且無論是啟用還是禁用都不影響系統核心模組的運行,也就是說外掛程式是一種非侵入式的模組化設計,實現了核心程式與外掛程式程式的鬆散耦合。一
Time of Update: 2016-07-25
$mysql_server_name='127.0.0.1'; //改成自己的mysql資料庫伺服器$mysql_username='使用者'; //改成自己的mysql資料庫使用者名稱$mysql_password='密碼'; //改成自己的mysql資料庫密碼$mysql_database='資料庫'; //改成自己的mysql資料庫名mysql_connect('127.0.0.1', $mysql_username,$mysql_password) or die('database
Time of Update: 2016-07-25
//引入資料庫設定檔include( dirname(dirname(__FILE__))."\include\config.php" );/**** 將資料庫中的文章產生單個HTML檔案.* @param Date $Date* @param Time $Time* @param String $Content* @param String $Title*/function
Time of Update: 2016-07-25
session_start();$k=$_GET['k'];$t=$_GET['t'];$allowTime = 1800;//防重新整理時間$ip = get_client_ip();$allowT = md5($ip.$k.$t);if(!isset($_SESSION[$allowT])){$refresh = true;$_SESSION[$allowT] = time();}elseif(time() - $_SESSION[$allowT]>$allowTime){$refresh
Time of Update: 2016-07-25
/** 功能: 作用跟substr一樣,除了它不會造成亂碼* 參數:* 返回:*/function utf8_substr( $str , $start , $length=null ){// 先正常截取一遍.$res = substr( $str , $start , $length );$strlen = strlen( $str );/* 接著判斷頭尾各6位元組是否完整(不殘缺) */// 如果參數start是正數if ( $start >= 0 ){//
Time of Update: 2016-07-25
$string = '杯子';$name = '咖啡';$str = '這個 $string 中裝有 $name.';echo $str;eval( "\$str = \"$str\";" );echo $str;?>複製代碼本例的傳回值為這個 $string 中裝有 $name.這個 杯子 中裝有
Time of Update: 2016-07-25
$file = 'bbs.it-home.org.php';if (is_readable($file) == false) {die('檔案不存在或者無法讀取');} else {echo '存在';}?>複製代碼is_readable() 函數判斷指定檔案名稱是否可讀。指定的檔案或目錄存在並且可讀,則返回 TRUE例2: $filename = 'bbs.it-home.org.php';if (file_exists($filename)) {echo "The file
Time of Update: 2016-07-25
/*** php關聯連結*/header("Content-Type:text/html;charset=utf-8"); //設定編碼$linkdatas=array(array('前端開發', 'http://http://bbs.it-home.org'),array('前端設計', 'http://bbs.it-home.org'),array('web前端', 'http://bbs.it-home.org'),array('前端部落格',
Time of Update: 2016-07-25
class runTime {private $starTime;//開始時間private $stopTime;//結束時間private function getMicTime(){$mictime=microtime();//擷取時間戳記和微秒數list($usec,$sec)=explode(" ",$mictime);//把微秒數分割成數組並轉換成變數處理return (float)$usec+(float)$sec;//把轉換後的資料強制用浮點點來處理}public