Time of Update: 2016-07-25
提取頁面和瀏覽器提交的變數,作用相當於使PHP.INI開了全域變數 //提取頁面和瀏覽器提交的變數,作用相當於使PHP.INI開了全域變數 //OSPHP.com.CN @extract($_SERVER, EXTR_SKIP); @extract($_SESSION, EXTR_SKIP); @extract($_POST, EXTR_SKIP); @extract(
Time of Update: 2016-07-25
相對路徑轉化成絕對路徑 //相對路徑轉化成絕對路徑 function relative_to_absolute($content, $feed_url) { preg_match('/(http|https|ftp):///', $feed_url, $protocol); $server_url =
Time of Update: 2016-07-25
package ims.common.util; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import
Time of Update: 2016-07-25
php產生excel文檔 header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=test.xls"); echo "test1t"; echo "test2tn"; echo "test1t"; echo "test2tn"; echo "test1t"
Time of Update: 2016-07-25
$serverName = "127.0.0.1";$connectionInfo = array( "UID"=>"sa","PWD"=>"","Database"=>"test");$conn = sqlsrv_connect( $serverName, $connectionInfo);if( $conn === false ){ echo "Could not connect.\n"; die( print_r( sqlsrv_errors(),
Time of Update: 2016-07-25
來自PHPCMS /** * 轉義 javascript 代碼標記 * * @param $str * @return mixed */ function trim_script($str) { if(is_array($str)){ foreach ($str as $key => $val){ $str[$key] = trim_script($val); }
Time of Update: 2016-07-25
操作mysql資料庫的php類 ///////////////////資料庫連接類////////////////////class connect{private $host;//主機名稱private $name;//使用者名稱private $pass;//密碼private
Time of Update: 2016-07-25
function base62($x){ $show = ''; while($x > 0) { $s = $x % 62; if ($s > 35) { $s = chr($s+61); } elseif ($s > 9 && $s $s = chr($s + 55); } $show .= $s; $x = floor($x/6
Time of Update: 2016-07-25
// 請求 PHPmailer類 檔案require_once("class.phpmailer.php");//發送Email函數function smtp_mail ( $sendto_email, $subject, $body, $extra_hdrs, $user_name) {$mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host = "smtp.163.com"; // SMTP
Time of Update: 2016-07-25
/** 說明:產生隨機碼,並用圖形方式顯示隨機碼。*/$ViewRandomCode = mt_rand(1000,10000);session_start();$_SESSION['checksum'] = $ViewRandomCode;function set_4pixel($r, $g, $b, $x, $y){global $sx, $sy, $pixels;$ofs = 3 * ($sx * $y + $x);$pixels[$ofs] = chr($r);$pixels[$ofs
Time of Update: 2016-07-25
/** * 建立圖片縮圖,成功返回真 * * @param string $cat 目錄 * @param string $oldname 原圖檔案名稱 * @param string $newname 新圖檔案名稱 * @param int $width 縮圖寬 * @param int $height 縮圖高 * @return */function
Time of Update: 2016-07-25
//strstr函數 $email = 'liruxing1715@sina.com@qq.com'; $domain = strstr($email, '@'); echo "strstr 測試結果:{$domain}"; $domain = strstr($email, '@', true); echo "strstr 測試結果:{$domain}"; /* 測試結果為: strstr 測試結果:@sina.com@qq.com strstr 測試結果:liruxing1715
Time of Update: 2016-07-25
/** * @author seraphim * @copyright 2013 * url: http:bbs.it-home.org*/ $ADMIN = array( 'defaulturl'=> 'http://www.xx.com/images/banner-header.gif', //盜鏈返回的地址 'url_1' => 'http://www.xx.net/file', 'url_2' => 'http://www.xx.net/file1', ); $okaysites =
Time of Update: 2016-07-25
$ch = curl_init();curl_setopt($ch, CURLOPT_URL, "http://localhost/2.php");curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:8.8.8.8', 'CLIENT-IP:8.8.8.8'));//IPcurl_setopt($ch, CURLOPT_REFERER, "http://bbs.it-home.org/ ");
Time of Update: 2016-07-25
php將$arr 二維數組的所有第二層合并後返回 array_merge() 將一個或多個數組的單元合并起來,一個數組中的值附加在前一個數組的後面。返回作為結果的數組。 但是只能合并第一層,卻無法合并二級數組的二維部分 我寫了點代碼,感覺很不好,希望高手指更好的方法 $arr=array("0" => array("44" => array("id" => 44,"
Time of Update: 2016-07-25
$this_year = 2013;$text = 祝無雙,F,1982,廣東,普遍職員李三兵,M,1981,河北,普通職員趙樸秀,F,1980,韓國,專案經理EOT;$lines = explode("\n", $text); //將多行資料分開foreach ($lines as $userinfo) { $info = explode(",", $userinfo, 3); //僅分割前三個資料 $name = $info[0]; $sex = ($info[1] ==
Time of Update: 2016-07-25
/** * author: goosman * blog: http://blog.csdn.net/lgg201 * mail: lgg860911@yahoo.com.cn */ $str = '01234567890120123456789'; function substr_remain_tag($s, $o, $l) { $is_match = preg_match_all( ;
Time of Update: 2016-07-25
public function searchArray($array,$key,$value){foreach($array as $keyp=>$valuep){if($valuep[$key]==$value){unset($array[$keyp]);}}return $array;}?>複製代碼您可能感興趣的文章:php建立數組的方法介紹php使用array_unique判斷數組中是否存在相同的值php數組函數 in_array()
Time of Update: 2016-07-25
//存入 $arr = array(1,2,3);$arr_str = serialize($arr); setcookie("a",$arr_str); //取出 $arr_str = $_COOKIE['a']; $arr = unserialize($arr_str);複製代碼方法二:設定多索引值cookie,注意必須給索引值 $arr = array(1,2,3); setcookie("a[0]", $arr[0]); setcookie("a[1]", $arr[
Time of Update: 2016-07-25
擷取伺服器資訊$sysos = $_SERVER["SERVER_SOFTWARE"]; //擷取伺服器標識的字串$sysversion = PHP_VERSION; //擷取PHP伺服器版本//以下兩條代碼串連mysql資料庫並擷取MySQL資料庫版本資訊mysql_connect("localhost", "mysql_user", "mysql_pass");$mysqlinfo =