php echo 輸出字符串函數(shù)詳解
復(fù)制代碼 代碼如下:echo "asd";//字符串 echo "ads$c";//字符串+變量 echo 'ads$c';//字符串 asd$c $c不是變量 echo "sd"."vs"; echo "sd","vs"; echo $a; echo $a.$b; echo $a,$b; echo $a.$b.$c; echo $a,$b,$c; e...
|
復(fù)制代碼 代碼如下:echo "asd";//字符串 echo "ads$c";//字符串+變量 echo 'ads$c';//字符串 asd$c $c不是變量 echo "sd"."vs"; echo "sd","vs"; echo $a; echo $a.$b; echo $a,$b; echo $a.$b.$c; echo $a,$b,$c; e...
復(fù)制代碼 代碼如下:public function insertUser ($userArray){ foreach ($userArray as $key => $value) { @$field .= "$key,"; @$content .= "'$value',"; } $field = ereg_replace(',$', '', $field); $content =...
經(jīng)過(guò)復(fù)雜的判斷與算是的獲取IP地址函數(shù) 復(fù)制代碼 代碼如下: function getIP() { if (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } elseif (getenv('HTTP_X_FORWARDED_FOR')) { $ip = getenv('HTT...
復(fù)制代碼 代碼如下:<?php $f=fopen("test.txt", "wb"); $text=utf8_encode("a!"); //先用函數(shù)utf8_encode將所需寫(xiě)入的數(shù)據(jù)變成UTF編碼格式。 $text="//xEF//xBB//xBF".$text; //"//xEF//xBB//xBF",這串字符不可缺少,...
復(fù)制代碼 代碼如下:<?php //上傳文件類(lèi)型列表 $uptypes=array( 'image/jpg', 'image/jpeg', 'image/png', 'image/pjpeg', 'image/gif', 'image/bmp', 'image/x-png' ); $max_file_size = 200000; //上傳文件大小限制...
getimagesize ― 取得圖像大小 說(shuō)明 array getimagesize ( string $filename [, array &$imageinfo ] ) getimagesize() 函數(shù)將測(cè)定任何 GIF,JPG,PNG,SWF,SWC,PSD,TIFF,BMP,IFF,JP2,JPX,JB2,JPC,XBM 或 WBMP 圖像文件的大小并返回...
php 讀取單選按鈕radio值 復(fù)制代碼 代碼如下: <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>php 讀取單選按鈕radio值</titl...
(PHP 4 >= 4.0.6, PHP 5) imagecreatetruecolor ― 新建一個(gè)真彩色圖像
說(shuō)明 resource imagecreatetruecolor ( int $x_size , int $y_size ) imagecreatetruecolor() 返回一個(gè)圖像標(biāo)識(shí)符,代表了一幅大小為 x_size...
這是擴(kuò)展yibing的select默認(rèn)選擇的實(shí)現(xiàn)方法 復(fù)制代碼 代碼如下: <select name="wuyeleixing" size="1"> <option <?php if($myrow[wuyeleixing]==1) echo("selected");?> value="1">住宅</option> <option <?php if($...
php獲取 checkbox復(fù)選框值的方法 復(fù)制代碼 代碼如下: <html xmlns="http://www.jb51.net/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>php獲取 checkbox復(fù)...
數(shù)據(jù)增加,刪除,查詢(xún),排序詳細(xì)說(shuō)明
對(duì)數(shù)組的添加(首尾數(shù)據(jù)添加(不限定條數(shù))以及中間任意位置添加數(shù)據(jù)操作) . 2~對(duì)數(shù)組的刪除(首尾的數(shù)據(jù)刪除(不限定條數(shù))以及中間任意位置的數(shù)據(jù)刪除操作,條件:對(duì)數(shù)組中間位置刪除的,后面的...
php 獲得當(dāng)前的腳本網(wǎng)址(只有路徑) 復(fù)制代碼 代碼如下: function GetCurUrl() { if(!empty($_SERVER["REQUEST_URI"])) { $scrtName = $_SERVER["REQUEST_URI"]; $nowurl = $scrtName; } else { $scrtName = $_SERVER...
復(fù)制代碼 代碼如下: <?php $memcached = array( //用memcached 的 多 進(jìn)程模擬 多臺(tái)memcached 服務(wù)器 cn en 為 內(nèi)存服務(wù)器名 'cn'=>array('192.168.254.144',11211), 'en'=>array('192.168.254.144',11212) ); $mysq...
編碼范圍1. GBK (GB2312/GB18030) /x00-/xff GBK雙字節(jié)編碼范圍 /x20-/x7f ASCII /xa1-/xff 中文 /x80-/xff 中文 2. UTF-8 (Unicode) /u4e00-/u9fa5 (中文) /x3130-/x318F (韓文 /xAC00-/xD7A3 (韓文) /u0800-/u4e00...
復(fù)制代碼 代碼如下: /** * 將一個(gè)字串中含有全角的數(shù)字字符、字母、空格或'%+-()'字符轉(zhuǎn)換為相應(yīng)半角字符 * @access public * @param string $str 待轉(zhuǎn)換字串 * @return string $str 處理后字串 */ function make_se...
在php5.3被放棄的函數(shù)有:
ereg();//直接用mb_ereg代替,或是preg_match代替,但是匹配規(guī)則需要用/包括起來(lái) eregi();//preg_match代替,在規(guī)則后加上i,如:preg_match(“/^(style|style_)(.*)*/i”, $file); ereg_replace();...
復(fù)制代碼 代碼如下:class CacheException extends Exception {} /** * 緩存抽象類(lèi) */ abstract class Cache_Abstract { /** * 讀緩存變量 * * @param string $key 緩存下標(biāo) * @return mixed */ abstract public func...
復(fù)制代碼 代碼如下:<?php session_start(); $k=$_GET['k']; $t=$_GET['t']; $allowTime = 1800;//防刷新時(shí)間 $ip = get_client_ip(); $allowT = md5($ip.$k.$t); if(!isset($_SESSION[$allowT])) { $refresh = true;...
比如第一次請(qǐng)求一個(gè)文件的從0到999字節(jié),第二次請(qǐng)求1000到1999字節(jié),以此類(lèi)推,每次請(qǐng)求1000字節(jié)的內(nèi)容,然后程序通過(guò)fseek函數(shù)去取得對(duì)應(yīng)的文件位置,然后輸出。 復(fù)制代碼 代碼如下:$fname = './05e58c19552bb26b158f6621a665...
復(fù)制代碼 代碼如下:function getthemonth($date) { $firstday = date('Y-m-01', strtotime($date)); $lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day")); return array($firstday, $lastday); }...
1: 用file_get_contents 以get方式獲取內(nèi)容 復(fù)制代碼 代碼如下: <?php $url='http://www.baidu.com/'; $html = file_get_contents($url); //print_r($http_response_header); ec($html); printhr(); printarr($http_...
網(wǎng)上有很多php文件上傳的類(lèi),文件上傳處理是php的一個(gè)特色(至少手冊(cè)上是將此作為php特點(diǎn)來(lái)展示的,個(gè)人認(rèn)為php在數(shù)組方面的優(yōu)異功能更有特色),學(xué)php的人都知道文件上傳怎么做,但很多人在編程中卻可能忽視了一些細(xì)節(jié)問(wèn)題,那...
eaccelerator.shm_size="32" eAccelerator 可以使用的共享內(nèi)存的數(shù)量 (以兆為單位) . "0" 是指操作系統(tǒng)的默認(rèn)值. 默認(rèn)值是 "0".可根據(jù)服務(wù)器的實(shí)際情況來(lái)調(diào)整,16,32,64,128都是可以的。
eaccelerator.cache_dir="/home...
1,年-月-日 echo date('Y-m-j'); 2007-02-6
echo date('y-n-j'); 07-2-6
大寫(xiě)Y表示年四位數(shù)字,而小寫(xiě)y表示年的兩位數(shù)字; 小寫(xiě)m表示月份的數(shù)字(帶前導(dǎo)),而小寫(xiě)n則表示不帶前導(dǎo)的月份數(shù)字。
echo date('Y-M-j'); 200...
原作者BlueStyle 提示 改進(jìn)地方有
以前的算法是等文件下載完才計(jì)算, 現(xiàn)在這個(gè)直接在在獲取文件時(shí)候就計(jì)算大小 加了容錯(cuò)語(yǔ)句 增加了判斷目錄,沒(méi)有目錄自動(dòng)創(chuàng)建 把計(jì)算文件大小的算法換了個(gè) 以前的那個(gè)光計(jì)算文件大小...