phpæ´çç¬è®°ä¸_php_web-itnose
é¦é¡µ
asp
php
javascript
iis
apache
html/css
coldfusion
ajax
vbscript
cgi
xml/xsl
è·¨æµè§å¨å¼å
ruby/rails
ç¨åºå
html5
jquery
seo
jboss
json
angularjs
markdown
nginx
thinkphp
yii
pageadmin
extjs
wampserver
kendo ui
coffeescript
gulp
ecmascript
bootstrap
itnoseé¦é¡µ > web > php >
phpæ´çç¬è®°ä¸
2017-06-14 15:29
åæµè§å¨ä¸è¾åºï¼
echo()ãprint()ãprintf()
echoãprintãprintfæ¬èº«æ¯å½æ°ï¼å³å½æ°()ãä½è¿éçè¾åºå½æ°å¯ä»¥çç¥æ¬å·ï¼ç¨ç©ºæ ¼+æéæ¾ç¤ºçå符串æåéã
echoåprintåè½å ä¹ç¸åï¼èechoè¿è¡é度ä¸æ¯printç¨ç¨å¿«ä¸ç¹ãå 为printæè¿åå¼ã
echoä¸è¿åä»»ä½å¼(void),printè¿åçæ¯æ´å(integer)
print_r()åªç¨äºè¾åºæ°ç»
printf()åsprintf()æ¯cè¯è¨æ¨¡å¼ï¼ä¾å¦:printf(“æä»å¤©ä¹°äº%då¥è§é¢å ç”,5);
//ä»ä»¬ä¹é´çä¸åç¹æ¯,printfè¿åçæ¯æ´å(integer)–å符çé¿åº¦ãèsprintfè¿åçå符串(string)
//printfå¯ä»¥å¨æµè§å¨ç´æ¥è¾åºï¼èsprintféè¦echoå°å®è¾åº
常ç¨ç±»åæ示符
ç±»å
æè¿°
%b
æ´æ°ï¼æ¾ç¤ºä¸ºäºè¿å¶
%c
æ´æ°ï¼æ¾ç¤ºä¸ºasciiå符
%d
æ´æ°ï¼æ¾ç¤ºä¸ºæ符å·åè¿å¶æ°
%f
æµ®ç¹æ°ï¼æ¾ç¤ºä¸ºæµ®ç¹æ°
%o
æ´æ°ï¼æ¾ç¤ºä¸ºå «è¿å¶æ°
%s
å符串ï¼æ¾ç¤ºä¸ºå符串
%u
æ´æ°ï¼æ¾ç¤ºä¸ºæ 符å·åè¿å¶æ°
%x
æ´æ°ï¼æ¾ç¤ºä¸ºå°åçåå è¿å¶æ°
%x
æ´æ°ï¼æ¾ç¤ºä¸ºå¤§åçåå è¿å¶æ°
2. æ è¯ç¬¦ä¸åé
æ è¯ç¬¦æ¯åéçå称ï¼å ³äºæ è¯ç¬¦ï¼phpå®ä¹äºä¸äºç®åçè§åï¼
ã»æ è¯ç¬¦å¯ä»¥æ¯ä»»ä½é¿åº¦ï¼èä¸å¯ä»¥ç±ä»»ä½åæ¯ãæ°åãä¸å线ç»æã
ã»æ è¯ç¬¦ä¸è½ä»¥æ°åå¼å§ã
ã»å¨phpä¸ï¼æ è¯ç¬¦æ¯åºå大å°åçã
ã»ä¸ä¸ªåéå称å¯ä»¥ä¸ä¸ä¸ªå½æ°å称ç¸åã
åéèµå¼ï¼
$sum=0;
$total=1.22;
$sum=$total;
åéçæ°æ®ç±»å
phpæ¯æå¦ä¸æ示çåºæ¬æ°æ®ç±»åï¼
integer(æ´æ°)ãfloat(æµ®ç¹æ°ï¼ä¹å«double,å精度)ãstring(å符串)ãboolean(å¸å°)ãarray(æ°ç»)ãobject(对象).
ç±»å强度
phpæ¯ä¸ç§é常弱çç±»åè¯è¨ãå¨å¤§å¤æ°ç¼ç¨è¯è¨ä¸ï¼åéåªè½ä¿åä¸ç§ç±»åçæ°æ®ï¼èä¸è¿ä¸ªç±»åå¿ é¡»å¨ä½¿ç¨åéä¹å声æãèå¨phpä¸ï¼åéçç±»åæ¯ç±èµå¼ç»åéçå¼ç¡®å®çã
ç±»å转æ¢
使ç¨ç±»å转æ¢ï¼å¯ä»¥å°ä¸ä¸ªåéæå¼è½¬æ¢æå¦ä¸ç§ç±»åã
$sum=0;
$total=(float)$sum;
æ£æµåé
大é¨åçå¯åå½æ°é½æ¯ç¨æ¥æµè¯ä¸ä¸ªå½æ°çç±»åçãphpä¸æ两个æ常è§çå½æ°ï¼åå«æ¯gettype()åsettype()ã
è¿ä¸¤ä¸ªå½æ°è¿åçstringç±»åï¼ä¹å°±æ¯åéçç±»åå符串ã
isset()åunset()ç¨æ¥å¤æä¸ä¸ªåéæ¯å¦åå¨ï¼è¿åçæ¯å¸å°å¼trueæfalseã
empty()ç¨æ¥å¤æä¸ä¸ªåéçå¼æ¯å¦ä¸ºç©ºï¼å¦æ为空å为trueå¦å为falseã
æ¢å¥è¯è¯´ï¼””ã0ã”0″ãnullãfalseãarray()ãvar $var; 以å没æä»»ä½å±æ§ç对象é½å°è¢«è®¤ä¸ºæ¯ç©ºç
phpè¿æä¾äºä¸äºç¹å®ç±»åçæµè¯å½æ°ãæ¯ä¸ä¸ªå½æ°é½ä½¿ç¨ä¸ä¸ªåé座ä½å ¶åæ°ï¼å¹¶ä¸è¿åtrueæfalseã
is_array()ãis_double()ãis_float()ãis_real()ãis_long()ãis_int()ãis_integer()ãis_string()ãis_object()ãis_resource()ãis_null()ãis_numeric()
å¯ä»¥éè¿è°ç¨ä¸ä¸ªå½æ°æ¥å®ç°è½¬æ¢åéæ°æ®ç±»åçç®çã
intval()ãfloatval()ãstrval();
ç解åéçä½ç¨å
ä½ç¨åæ¯æå¨ä¸ä¸ªèæ¬ä¸æ个åéå¨åªäºå°æ¹å¯ä»¥ä½¿ç¨æå¯è§ã
å ç½®è¶ çº§å ¨å±åéå¯ä»¥å¨èæ¬çä»»ä½å°æ¹ä½¿ç¨åå¯è§ã
常éï¼ä¸æ¦è¢«å£°æï¼å°å¯ä»¥å¨å ¨å±å¯è§ãä¹å°±æ¯è¯´ï¼ä»ä»¬å¯ä»¥å¨å½æ°å å¤ä½¿ç¨ã
å¨ä¸ä¸ªèæ¬ä¸å£°æçå ¨å±åéå¨æ´ä¸ªèæ¬ä¸æ¯å¯è§çï¼ä½ä¸æ¯å¨å½æ°å é¨ã
å½æ°å é¨ä½¿ç¨çåé声æä¸ºå ¨å±åéæ¶ï¼å ¶å称è¦ä¸å ¨å±åéå称ä¸è´ã
å¨å½æ°å é¨å建并被声æ为éæçåéæ æ³å¨å½æ°å¤é¨å¯è§ï¼ä½æ¯å¯ä»¥å¨å½æ°çå¤æ¬¡å¤æ¬¡æ§è¡è¿ç¨ä¸ä¿ææ¹å¼
å¨å½æ°å é¨å建çåé对å½æ°æ¥è¯´æ¯æ¬å°çï¼èå½å½æ°ç»æ¢æ¶ï¼è¯¥åéä¹å°±ä¸åå¨äºã
è¶ çº§å ¨å±åéï¼
$globals ææå ¨å±åéæ°ç»
$_server æå¡å¨ç¯å¢åéæ°ç»
$_get éè¿getæ¹æ³ä¼ éç»è¯¥èæ¬çåéæ°ç»
$_post éè¿postæ¹æ³ä¼ éç»è¯¥èæ¬çåéæ°ç»
$_cookie cookieåéæ°ç»
$_files ä¸æ件ä¸è½½ç¸å ³çåéæ°ç»
$_env ç¯å¢åéæ°ç»
$_request ææç¨æ·è¾å ¥çåéæ°ç»
$_session ä¼è¯åéæ°ç»
常é
常éä¸æ¦è¢«å®ä¹ä¹åï¼å°±ä¸è½å次æ´æ¹ã
define(“total”,199);
é¤äºèªå®ä¹å¸¸éå¤ï¼phpè¿é¢å®äºè®¸å¤å¸¸éãäºè§£è¿äºå¸¸éçç®åæ¹æ³å°±æ¯è¿è¡phpinfo()å½ä»¤ã
åéå常éçå¦ä¸ä¸ªå·®å¼å¨äºå¸¸éåªå¯ä»¥ä¿åå¸å°å¼ãæ´æ°ãæµ®ç¹æ°æå符串æ°æ®ãè¿äºç±»åé½æ¯æ éæ°æ®ã
3.访é®è¡¨ååé
å¨phpèæ¬ä¸ï¼å¯ä»¥ä»¥phpåéçå½¢å¼è®¿é®æ¯ä¸ä¸ªè¡¨ååï¼å ¶ä¸phpåéåç§°å¿ é¡»ä¸è¡¨ååçå称ä¸è´ãä½ å¯ä»¥å¾å®¹æè¯å«phpçåéå称ï¼å 为ä»ä»¬é½æ¯ä»¥$符å·å¼å§çãï¼æ¼æè¿ä¸ª$符å·æ¯ä¸ä¸ªå¸¸è§çç¼ç¨é误ãï¼
æ ¹æ®phpçæ¬å设置çä¸åï¼éè¿åéï¼å¯ä»¥æ3ç§æ¹æ³æ¥è®¿é®è¡¨åæ°æ®ãè¿äºæ¹æ³å¹¶æ²¡ææ£å¼çå称ï¼å æ¤æ们ç»ä»ä»¬å®ä¹äº3个æµç§°ï¼åå«æ¯ç®çé£æ ¼ãä¸çé£æ ¼ååé¿é£æ ¼ãå¨ä»»ä½æ åµä¸ï¼ä¸ä¸ªé¡µé¢ä¸æ交ç»phpèæ¬çæ¯ä¸ä¸ªè¡¨ååå¨phpèæ¬ä¸é½æ¯å¯ä»¥ä½¿ç¨çã
$username //ç®çé£æ ¼
$_post[“username”] //ä¸çé£æ ¼ $_get[“qqname”];
$http_post_vars[“username”] //åé¿é£æ ¼ $_
ã»ç®çé£æ ¼ï¼é常æ¹ä¾¿ï¼ä½å®¹æå¼èµ·æ··æ·ï¼ä¸æ¨è
ã»ä¸çé£æ ¼ï¼4.1.0çåæ¯æï¼æ¨èç
ã»åé¿é£æ ¼ï¼æ详ç»ï¼ä½å®å·²ç»è¿æ¶ï¼é¿è¿è§åº¦çï¼ä»¥åä¼è¢«åé¤
å符串è¿æ¥ï¼ä½¿ç¨ç¹å°±å¯ä»¥è¿æ¥”.”;
ç¸å
³æç´¢ï¼
oracleç¬è®°
javaåºç¡ç¬è®°
htmlå¦ä¹ ç¬è®°
c++å¦ä¹ ç¬è®°
c++ç¬è®°
ç¸å ³æç«
2017-06-15 09:41 phpæ´çç¬è®°äº
2016-12-09 12:28 php常ç¨å½æ°æ´ç
2016-12-01 03:30 phpå¦ä¹ èµæºæ´ç
2015-07-06 09:18 æ´çä¸äºphpå¼åå®å
¨é®é¢
2014-06-16 16:28 ä¸äºå¸¸ç¨çphpå½æ°(æ´ç)
æ´å¤ç¸å ³æç« >>
ææ°æç«
2017-06-20 01:35 èé们ï¼æ没æå¯è½è®©phpæ件åæ¶åªè½ä¸ä¸ªäººè®¿é®
2017-06-20 01:35 æä¹ç¦æ¢å¾çç´æ¥éè¿url访é®
2017-06-20 01:35 æ±æ!å¯å¨wampåªè½ç¨æ¬æºè®¿é®,åå±åç½çå
¶å®è®¾å¤è®¿é®ä¸å°!æäºå¤§å天t-t
2017-06-19 15:35 nginxä¸çthinkphpé®é¢
2017-06-19 15:35 php form æ件ä¸ä¼
æ´å¤ææ°æç« >>
çé¨æç´¢
oracleå¦ä¹ ç¬è®°
hibernate ä¸å¯¹ä¸
ä¸å¼ å¾è¡¨
php jsp
php webservice
php å¾è¡¨
php xml
delphi for php
delphi php
php sqlserver
hibernateä¸å¯¹ä¸æ¥è¯¢
hibernate ä¸å¯¹å¤
hibernateä¸çº§ç¼å
hibernate ä¸çº§ç¼å
phpå.net
京icpå¤14022385å·-2
©2014 itnose软件ç¼ç¨æç¨ | èç³»æ们ï¼emailï¼twobrushes@126.com qq:35155868