php實現301重新導向的方法

$the_host = $_SERVER['HTTP_HOST']; //標記取得當前網域名稱$request_url = isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:''; //判斷地址後面部分if($the_host !== ‘bbs.it-home.org’) //沒有更換的網域名稱地址{header('HTTP/1.1 301 Moved Permanently'); //

php使用curl判斷遠程檔案是否存在的代碼

//判斷遠程檔案function check_remote_file_exists($url){$curl = curl_init($url);// 不取回資料curl_setopt($curl, CURLOPT_NOBODY, true);// 發送請求$result = curl_exec($curl);$found = false;// 如果請求沒有發送失敗if ($result !== false) {// 再檢查http響應碼是否為200$statusCode =

php5中$_SERVER變數不再受magic_quotes_gpc保護的替代方法

$magic_quotes_gpc = get_magic_quotes_gpc();@extract(daddslashes($_COOKIE));@extract(daddslashes($_POST));@extract(daddslashes($_GET));if(!$magic_quotes_gpc) {$_FILES = daddslashes($_FILES);}//---daddslashes函數//轉譯字元函數function daddslashes($string) {if(

php寫的用來檢測手機信箱使用者名的類

/*** Check手機信箱使用者名檢測類*/Class Check{ /** * IsUsername函數:檢測是否符合使用者名稱格式 * $Argv是要檢測的使用者名稱參數 * $RegExp是要進行檢測的正則語句 * 傳回值:符合使用者名稱格式返回使用者名稱,不是返回false */ Function IsUsername($Argv){ $RegExp='/^[a-zA-Z0-9_]{3,16}$/'; //由大小寫字母跟數字組成並且長度在3-16字元直接 return

php寫的webshell超強免殺工具的代碼

/*Title: PHP shell nokill T00LBlog: exploit-db.blogcn.com*/error_reporting(0);@ini_set('memory_limit','-1');set_time_limit(0);$toolname="$argv[0]";if ($argcbaner($toolname);die;}$input_file= trim($argv[1]);$output_file='nokill_'.$input_file;if (file_

根據utf8編碼規律截取字串的函數(utf8版的sub_str)

/** 功能: 作用跟substr一樣,除了它不會造成亂碼* 參數:* 返回:*/function utf8_substr( $str , $start , $length=null ){// 先正常截取一遍.$res = substr( $str , $start , $length );$strlen = strlen( $str );/* 接著判斷頭尾各6位元組是否完整(不殘缺) */// 如果參數start是正數if ( $start >= 0 ){//

php使用mysql_data_seek將指標移動到資料集初始位置的代碼

// Start snipit 1$sql = "SELECT * from ";$result = mysql_query($sql);while ($row = mysql_fetch_assoc($result)) {// do stuff with $row}mysql_data_seek($result, 0); //關鍵是這兒while ($row = mysql_fetch_assoc($result)) {// do other stuff with

php eval函數用法及相關技巧

$string = '杯子';$name = '咖啡';$str = '這個 $string 中裝有 $name.';echo $str;eval( "\$str = \"$str\";" );echo $str;?>複製代碼本例的傳回值為這個 $string 中裝有 $name.這個 杯子 中裝有

php調用外部shell的方法總結

system("/usr/local/bin/webalizer/webalizer");?>複製代碼exec()原型:string exec (string command [, string array [, int return_var]])exec() 函數與system()類似,也執行給定的命令,但不輸出結果,而是返回結果的最後一行。雖然它只返回命令結果的最後一行,但用第二個參數array可以

php的eval函數用法小結

$string = "beautiful";$time = "winter";$str = 'This is a $string $time morning!';echo $str. "";eval("$str = "$str";");echo $str;?>  複製代碼輸出:This is a $string $time morning!This is a beautiful winter morning!eval() 函數在CodeIgniter架構裡也有用到。在

使用php判斷檔案是否存在、是否可讀、目錄是否存在

$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

php添加關聯連結的代碼

/*** 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('前端部落格',

php中的daddslashes()和saddslashes()的區別

//----saddslashesfunction daddslashes($string, $force = 0, $strip = FALSE) {//字串或數組 是否強制 是否去除//如果魔術引用未開啟 或 $force不為0if(!MAGIC_QUOTES_GPC || $force) {if(is_array($string)) { //如果其為一個數組則迴圈執行此函數foreach($string as $key => $val) {$string[$key] =

php使用curl偽造IP來源的代碼

$ch = curl_init();$url = "http://localhost/target_ip.php";$header = array('CLIENT-IP:58.68.44.61','X-FORWARDED-FOR:58.68.44.61',);curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_HTTPHEADER, $header);curl_setopt($ch,

一個測試php程式已耗用時間的類

class runTime {private $starTime;//開始時間private $stopTime;//結束時間private function getMicTime(){$mictime=microtime();//擷取時間戳記和微秒數list($usec,$sec)=explode(" ",$mictime);//把微秒數分割成數組並轉換成變數處理return (float)$usec+(float)$sec;//把轉換後的資料強制用浮點點來處理}public

php實現的無極分類(遞迴)的代碼

$conn=mysql_connect("localhost","root","myoa888");mysql_select_db("lost63",$conn) or die("select db error");$sql[]="Create TABLE `lost63`.`dd_book_class` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,`classname` VARCHAR( 50 ) NOT NULL ,`classid`

一個計算程式已耗用時間的php類

/*** 計算程式已耗用時間* filename: js_runtime.php*/class Timer {private $StartTime = 0;//程式運行開始時間private $StopTime = 0;//程式運行結束時間private $TimeSpent = 0;//程式運行花費時間function start(){//程式運行開始$this->StartTime = microtime();}function stop(){//程式運行結束$this->StopTime

php把無限級分類產生數組的類

set aa=new classlistaa.id="id"//編號的名稱aa.classname="classname"//分類名稱aa.pid="pid"//父ID名稱aa.db_name="class"//表名list=aa.arrylist()?>複製代碼類:classlist class classlistprivate c_idprivate c_db_nameprivate c_pidprivate c_classnamepublic property let

php冒泡排序與快速排序的例子

function bubbingSort(array $array){for($i=0, $len=count($array)-1; $i{for($j=$len; $j>$i; --$j){if($array[$j] {$temp = $array[$j];$array[$j] = $array[$j-1];$array[$j-1] = $temp;}}}return $array;}print

php中display_errors與log_errors的區別

# vim /etc/php.inidisplay_errors = Offlog_errors = Onerror_log = /var/log/php-error.log複製代碼另外也可以設定error_log = syslog,使這些錯誤資訊記錄到作業系統的日誌裡。display_errors = Off //display中文意思是顯示所以display_error=off的意思就是不顯示錯誤了!error_reporting

總頁數: 5203 1 .... 1556 1557 1558 1559 1560 .... 5203 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.