PHP主要有八種基本數(shù)據(jù)類型,其中包括:

甘泉網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,甘泉網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為甘泉1000多家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站制作要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的甘泉做網(wǎng)站的公司定做!
1.四種變量類型
整數(shù)型(integer)
浮點(diǎn)數(shù)型(float)
布爾型(boolean)
字符串(string)
2.兩種復(fù)合類型
數(shù)組(array)
對(duì)象(object)
3.兩種特殊類型
NULL
資源 (resource)
方法1、最常見的方法是:$_post['fieldname'];
說明:只能接收content-type:
application/x-www-form-urlencoded提交的數(shù)據(jù)
解釋:也就是表單post過來的數(shù)據(jù)
方法2、file_get_contents("php://input");
說明:
允許讀取
post
的原始數(shù)據(jù)。
和
$http_raw_post_data
比起來,它給內(nèi)存帶來的壓力較小,并且不需要任何特殊的
php.ini
設(shè)置。
php://input
不能用于
enctype="multipart/form-data"。
解釋:
對(duì)于未指定
content-type
的post數(shù)據(jù),則可以使用file_get_contents(“php://input”);來獲取原始數(shù)據(jù)。
事實(shí)上,用php接收post的任何數(shù)據(jù)都可以使用本方法。而不用考慮content-type,包括二進(jìn)制文件流也可以。
所以用方法二是最保險(xiǎn)的方法
方法3、$globals['http_raw_post_data'];
說明:
總是產(chǎn)生
$http_raw_post_data
變量包含有原始的
post
數(shù)據(jù)。
此變量?jī)H在碰到未識(shí)別
mime
類型的數(shù)據(jù)時(shí)產(chǎn)生。
$http_raw_post_data
對(duì)于
enctype="multipart/form-data"
表單數(shù)據(jù)不可用
如果post過來的數(shù)據(jù)不是php能夠識(shí)別的,可以用
$globals['http_raw_post_data']來接收,
比如
text/xml
或者
soap
等等
解釋:
$globals['http_raw_post_data']存放的是post過來的原始數(shù)據(jù)。
$_post或$_request存放的是
php以key=value的形式格式化以后的數(shù)據(jù)。
但$globals['http_raw_post_data']中是否保存post過來的數(shù)據(jù)取決于centent-type的設(shè)置,即post數(shù)據(jù)時(shí)
必須顯式示指明content-type:
application/x-www-form-urlencoded,post的數(shù)據(jù)才會(huì)存放到
$globals['http_raw_post_data']中
describe?tablename;????????????//獲取表結(jié)構(gòu)信息
describe?tablename?fieldname;??//獲取表的某個(gè)字段結(jié)構(gòu)信息
比如:describe?users?username;?//獲取users表的username字段的結(jié)構(gòu)信息
返回:array(
'Field'????='username',
'Type'?????='varchar(50)',
'Null'?????='NO',
'Key'??????='UNI',
'Default'??='',
'Extra'????=''
)
標(biāo)量數(shù)據(jù)類型是數(shù)據(jù)結(jié)構(gòu)最基礎(chǔ)的單元,只能存儲(chǔ)一個(gè)數(shù)據(jù)。在 PHP 中的標(biāo)量數(shù)據(jù)類型分為四種
boolean(布爾型) 最簡(jiǎn)單的數(shù)據(jù)類型,只有兩個(gè)值:true(真) / false(假)
string(字符串) 字符串是連續(xù)的字符序列
integer(整型) 整型數(shù)據(jù)類型包含所有的整數(shù),其可以是整數(shù)也可以是負(fù)數(shù)
float(浮點(diǎn)型) 浮點(diǎn)型數(shù)據(jù)類型也是用來存儲(chǔ)數(shù)字,與整型不同它包含小數(shù)
PHP 支持8種基本的數(shù)據(jù)類型。
一:四種標(biāo)量類型:
1、boolean (布爾型)
2、integer (整型)
3、float (浮點(diǎn)型, 也稱作 double)
4、string (字符串)
二:兩種復(fù)合類型:
1、array (數(shù)組)
2、object (對(duì)象)
三:兩種特殊類型:
1、resource (資源)
2、NULL (NULL)
PHP,是英文超文本預(yù)處理語言Hypertext Preprocessor的縮寫。PHP 是一種 HTML 內(nèi)嵌式的語言,是一種在服務(wù)器端執(zhí)行的嵌入HTML文檔的腳本語言,語言的風(fēng)格有類似于C語言,被廣泛地運(yùn)用。
php 函數(shù)的參數(shù)類型可以指定為類名或數(shù)組類型array,比如 這樣是對(duì)的public function Right( My_Class $a, array $b ) 這樣是錯(cuò)的public function Wrong( string $a, boolean $b ) 如果需要其他類型
網(wǎng)站題目:獲取php數(shù)據(jù)類型,簡(jiǎn)述php可支持哪些數(shù)據(jù)類型
網(wǎng)站URL:http://chinadenli.net/article11/dsispgd.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計(jì)公司、動(dòng)態(tài)網(wǎng)站、靜態(tài)網(wǎng)站、電子商務(wù)、網(wǎng)站策劃、小程序開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)