Time of Update: 2018-12-05
使用preg_replace,正則替換檔案日期,通過例子僅供參考preg_replace使用方法。 $string = '認證_11.pdf_0415112452.pdf.doc';$uniqname = '_' .date("mdHis");echo "$string<br>";//找到最後一個"_" ,然後截取_前面文字$pattern = "/^(.*)/_(/d*)/.(.*)/";$replacement = "$1$uniqname";$str1 =
Time of Update: 2018-12-05
PHP安全愛好者的盛宴the Month of PHP Security 。拜讀php-security上的很多牛文,發出來共用下啦,都是偶像哇。 From:http://hi.baidu.com/menzhi007一 代碼執行函數PHP中可以執行代碼的函數。如eval()、assert()、“、system()、exec()、shell_exec()、 passthru()、 escapeshellcmd()、pcntl_exec() 等demo code 1.1:<?phpecho `
Time of Update: 2018-12-05
<?php // 擷取檔案夾大小 function getDirSize($dir) { $handle = opendir($dir); while (false!==($FolderOrFile = readdir($handle))) { if($FolderOrFile != "." && $FolderOrFile != "..") {
Time of Update: 2018-12-05
PHP開發工具ZendStudio_6.1亂碼解決終極方法 【寫在前面】如果你發現經常需要設定某個project下的檔案編碼時,請確認一下project的屬性設定。單擊“屬性”,出現:預設是“從容器繼承(GBK)”,現在設定成下面的UTF-8,這樣以後在這個project裡建立的檔案就是utf8編碼了。 首先,我要說明的是,我是一個剛學習PHP的新手!剛開始接觸PHP時候,一段時間在為尋找開發工具犯愁!!於是,我來到PHPCHINA尋求協助,果然,我找到了中意的PHP開發工具了,它名為:Ze
Time of Update: 2018-12-05
一,什麼是 PEAR? PEAR是PHP的官方開源類庫, PHP Extension and Application
Time of Update: 2018-12-05
在採集程式或者蜘蛛程式中經常會遇到一類問題,就是將網頁中相對路徑形式的URL轉換為絕對路徑形式的URL。例如在http://www.msphome.cn/blog/1/這個頁面中,有一個URL連結為../index.php,那麼我們要將它轉換為http://www.msphome.cn/blog/index.php。下面給出瞭解決這類問題的代碼。該程式能夠成功處理各種URL,將其變成絕對形式。<?php$a = 'http://www.abc.com/a/index.html';$b =
Time of Update: 2018-12-05
<?php session_start(); session_register("u_name");require_once("../config/db.inc.php");require_once("../config/config.inc.php");require_once("../config/function.php");require_once("../config/set.php");?><!DOCTYPE HTML PUBLIC "-//W3C//DTD
Time of Update: 2018-12-05
from CTB class CtbClass { var $file; var $index; //建立一個檔案並寫入輸入 function null_write($new) { $f=fopen($this->file,"w");
Time of Update: 2018-12-05
1,require是無條件包含也就是如果一個流程裡加入require,無論條件成立與否都會先執行require 這個已經不適用了,因為require 可以包含變數指向的檔案如 if($a = 1){ $file = '1.php '; }else{ $file = '2.php '; } require($file); 2,包含檔案不存在或者語法錯誤的時候require是致命的, include不是
Time of Update: 2018-12-05
1. 先安裝memcache php組件wget http://pecl.php.net/get/memcache-3.0.6.tgztar -zxvfmemcache-3.0.6.tgzcd memcache-3.0.6/usr/local/php/bin/phpize && ./configure --enable-memcache && make註:會提示 php-onfig
Time of Update: 2018-12-05
轉載自 http://deidara.blog.51cto.com/400447/93887作業系統:ubuntu 7.10web1 : apache2.24 IP:192.168.1.105web2: apache2.24 IP:192.168.1.106php : PHP 5.2.3 軟體 php5-memcache memcacheweb1 安裝 今天想到以前用 nfs 掛載磁碟的笨辦法來解決 php
Time of Update: 2018-12-05
1.將字串轉換成小寫 strtolower(): 該函數將傳入的字串參數所有的字元都轉換成小寫,並以小定形式放回這個字串.例:<?php $str = "I want To FLY"; $str = strtolower($str); echo $str;?>輸出結果:i want to fly2.將字元轉成大寫 strtoupper():
Time of Update: 2018-12-05
終於找到一個優秀的整合方案---quercus.quercus被整合在resin中,也可以放到tomcat等容器下去,但據說和resin結合得最好。安裝resin步驟:http://www.caucho.com/resin-3.0/quercus/tutorial/hello/index.xtpquercus現在支援php5.2
Time of Update: 2018-12-05
FaceBook 發布了一款能將php代碼轉換為C++的工具,hiphop如果你的網站很大,類似新浪這樣的大型門戶,可以考慮。目前已經在CentOS和ubuntu等Linux伺服器上編譯通過。安裝:一、需要依賴的包cmake 2.6 is the minimum versiong++/gcc 4.3 is the minimum versionBoost 1.37 is the minimum versionflexbisonre2clibmysqllibxml2libmcryptlibicu
Time of Update: 2018-12-05
<?php//定義一個數組$arr = array(0=>"zero", 1=>"one", 2=>"two");//使用第一種方法對數組進行遍曆foreach ($arr as $value) { echo "Value: $value; ";}echo "<BR>";//使用第二種方法對數組進行遍曆foreach ($arr as $key => $value) { echo "Key: $key; Value: $value; ";}?
Time of Update: 2018-12-05
<?php$array = array("a", "b","c");//定義數組$array[] = "Simon";//增加一個新的數組元素print_r($array);//輸出數組?><?php$array = array("a", "b","c");//定義數組$array[9] = "Simon";//增加一個新的數組元素print_r($array);//輸出數組?><?php//建立一個簡單的數組$array = array(0=>1, 1=&
Time of Update: 2018-12-05
------------------------------------------------ excel_export.php ----<?phpheader('Cache-Control: no-cache, must-revalidate');header('Content-type: application/vnd.ms-excel');header('Content-Disposition:
Time of Update: 2018-12-05
樣本說明: 其中:http://203.156.244.227:80/cgi-bin/get_score.fcgi為要代理的URL,參數為content本文內容。GET方法代理:<?php$searchUrl = 'http://203.156.244.227:80/cgi-bin/get_score.fcgi?content=';if(!empty($_GET['content'])){$searchUrl .= $_GET['content'];}echo
Time of Update: 2018-12-05
PHP和Python/Ruby的運行機制有一個本質區別:PHP是每次HTTP請求過來以後,初始化全部資源(例如建立資料庫連結、載入系統類別庫,建立緩衝等等),處理完畢,釋放全部資源,稱為PHP的解釋運行機制。這不像Python/Ruby之類帶有GC的指令碼語言,Python/Ruby是初次啟動的時候初始化資源,隨後的請求就不必再次初始化資源了。這種機制的差異帶來的區別就是:1、PHP極難出現嚴重的記憶體泄露問題,隨便你代碼寫的多爛,反正每個請求一執行完畢,所有資源統統釋放光。而Python/Ru
Time of Update: 2018-12-05
點編輯器的上傳圖片或上傳檔案按鈕彈出的對話方塊就會報錯,"d_file.myform.uploadfile 為空白或不是對象,在製作項目時遇到這個的問題,像以往都是因為圖片儲存目錄不存在或沒有許可權,但查看這些都沒有問題,而且在不同的用戶端,有正常顯示的,有的則報指令碼錯誤,突然想到,是不是因為表單項目,id和name只給了一個,查看ewebeditor的upload.php檔案,設定了表單id及uploadfile項的id,儲存後,測試正常.