Rumah  >  Artikel  >  pembangunan bahagian belakang  >  php涓殑鍗曞紩鍙枫€佸弻寮曞彿鍜岃浆涔夊瓧绗PHP鏁欑▼ | 甯涔嬪

php涓殑鍗曞紩鍙枫€佸弻寮曞彿鍜岃浆涔夊瓧绗PHP鏁欑▼ | 甯涔嬪

WBOY
WBOYasal
2016-07-14 10:11:451732semak imbas

PHP鍗曞紩鍙峰強鍙屽紩鍙峰潎鍙互淇グ瀛楃涓茬被鍨嬬殑鏁版嵁锛屽鏋滀慨楗扮殑瀛楃涓蹭腑鍚湁鍙橀噺锛堜緥$name锛夛紱鏈€澶х殑鍖哄埆鏄細 鍙屽紩鍙蜂細鏇挎崲鍙橀噺鐨勫€硷紝鑰屽崟寮曞彿浼氭妸瀹冨綋鍋氬瓧绗︿覆杈撳嚭銆?/p>

渚嬪锛?/p>

         $name="string";

        echo  " 瀛楃涓?quot; . '$name';

        echo   "瀛楃涓?quot; .  "$name";

?>

缁撴灉锛?/p>

         瀛楃涓?name

         瀛楃涓瞫tring

 

 

杞箟瀛楃锛岄【鍚嶆€濅箟浼氬皢瑙勫畾鐨勮娉曠敤"\"鏉ヨ緭鍑恒€備絾璇硶瑙勫畾鍦ㄤ笉鍚岀殑绯荤粺涓浆涔夊瓧绗︾殑浣滅敤涓嶅悓锛屼緥濡傦細windows涓嬬殑鍥炶溅鎹㈣绗︾敤"\r"鎴?quot;\n"锛岃€孡inux 杩欎袱灏辨湁寰堝ぇ鐨勫尯鍒細"\r"鍏夋爣鍥炲埌琛岄锛屼絾杩樺湪鏈; "\n"琛ㄧず涓嬩竴琛岋紝涓嶄細鍥炲埌琛岄銆?/p>

PHP涓殑杞箟瀛楃鏈?      

                                            " \n" ==>鎹㈣              

                                             "\r"==>鍥炶溅          

                                             "\t"==>姘村钩鍒惰〃绗?nbsp;     

                                             "\\"==> 鍙嶆枩鏉?/p>

                                            "\$" ==>缇庡厓绗﹀彿   

                                              " \' "==>鍗曞紩鍙?nbsp;   

                                              " \" " ==>鍙屽紩鍙?/p>

                                              " \[0-7]{1,3}  "            姝e垯琛ㄨ揪寮忓尮閰嶄竴涓叓杩涘埗绗﹀彿琛ㄧず鐨勫瓧绗?/p>

                                             " \x[0-9A-Fa-f]{1,2} "    姝e垯琛ㄨ揪寮忓尮閰嶄竴涓崄鍏繘鍒剁鍙疯〃绀虹殑瀛楃

 

 

 

鍦≒HP涓紝鍙互浣跨敤 echo() 鍜?print() 璇彞鍙戦€佹暟鎹埌Web娴忚鍣紝涔熷彲浠ヤ娇鐢ㄥ畠浠彂閫丠TML 浠g爜鍒癢eb娴忚鍣ㄣ€備粠鎶€鏈笂璁诧紝echo() 鍜?print() 鏄瑷€鏋勯€狅紝鑰屼笉鏄嚱鏁帮紝杩欓噷鐢ㄤ簡涓€瀵规嫭鍙凤紝浠庤€屾湁鍔╀簬涓庡彉閲忎互鍙奝HP鐨勫叾浠栭儴鍒嗗尯鍒嗗紑銆傝繖涓や釜璇彞鏈川涓婃病鏈変粈涔堝尯鍒紝鍥犳鐢ㄩ偅涓€涓兘涓嶄細浜х敓浠讳綍闂銆傝繖渚濅釜浜轰範鎯€傚畠浠笉鍖哄垎澶у皬瀛椼€?/p>

鍦≒HP涓紝鐞嗚В鍗曞紩鍙蜂笌鍙屽紩鍙锋湁浠€涔堝尯鍒槸閲嶈鐨勩€傚綋鎵€鍙戦€佺殑鏁版嵁涓秹鍙婂埌鍗曞紩鍙峰拰鍙屽紩鍙锋椂锛屽湪鎵撳嵃鍙屽紩鍙锋椂浣跨敤鍗曞紩鍙凤紝鍙嶄箣浜︾劧锛屽锛?/p>

echo 'She said,"How are you?"';

print "I'm just ducky.";

鎴栬€咃紝閫氳繃鍦ㄦ湁闂鐨勫瓧绗﹀墠闈㈡斁缃竴涓弽鏂滄潬锛屽瀹冭繘琛岃浆涔夛細

echo "She said,\"How are you?\" ";

print 'I\'m just ducky.';

鍦≒HP涓紝灏侀棴鍦ㄥ崟寮曞彿鍐呯殑鍊煎皢鐓у瓧闈㈡剰涔夎繘琛屽鐞嗭紝鑰屽皝闂湪鍙屽紩鍙峰唴鐨勫€煎垯灏嗚瑙i噴銆傛崲鍙ヨ瘽璇达紝鎶婂彉閲忓拰鐗规畩瀛楃锛堣琛?锛夋斁鍦ㄥ弻寮曞彿鍐呭皢瀵艰嚧鎵撳嵃鍑哄畠浠墍琛ㄧず鐨勫€硷紝鑰屼笉鏄畠浠殑瀛楅潰鍊笺€傚锛?/p>

$var = 'test';

浠g爜echo "var is equal to $var"; 灏嗘墦鍗板嚭 var is equal to test锛岃€屼唬鐮乪cho 'var is equal to $var'; 灏嗘墦鍗板嚭var is equal to $var銆備娇鐢ㄤ竴涓浆涔夌殑缇庡厓绗﹀彿锛屼唬鐮乪cho"\$var is equal to $var"; 灏嗘墦鍗板嚭$var is equal to test锛岃€屼唬鐮乪cho '\$var is equal to $var'; 灏嗘墦鍗板嚭\$var is equal to $var銆?/p>

琛? 褰撳湪鍙屽紩鍙峰唴浣跨敤杩欎簺瀛楃鏃讹紝瀹冧滑鍏锋湁鐗规畩鐨勫惈涔?/p>

 

 

杞箟瀛楃浠g爜 杞箟瀛楃鐨勫惈涔?br /> \ " 鍙屽紩鍙?br /> \ ' 鍗曞紩鍙?br /> \ \ 鍙嶆枩鏉?br /> \ n 鎹㈣绗?br /> \ r 鍥炶溅绗?br /> \ t 鍒惰〃绗?br /> \ $ 缇庡厓绗﹀彿

 

 

姝e浠ヤ笂渚嬪瓙鎵€璇存槑鐨勶紝鍙屽紩鍙峰皢鐢ㄥ彉閲忕殑鍊硷紙test锛変唬鏇垮畠鐨勫悕绉帮紙$var锛夛紝骞剁敤鐗规畩瀛楃琛ㄧず鐨勫€硷紙$锛変唬鏇垮畠鐨勪唬鐮侊紙\$锛夈€傚崟寮曞彿鎬绘槸鍑嗙‘鍦版墦鍗颁綘杈撳叆鐨勫唴瀹癸紝闄や簡杞箟鐨勫崟寮曞彿锛圽'锛夊拰杞箟鐨勫弽鏂滄潬锛圽\锛変箣澶栵紝瀹冧滑灏嗗垎鍒鎵撳嵃涓轰竴涓崟寮曞彿鍜屼竴涓弽鏂滄潬銆?/p>

鎻愮ず锛?/p>

1銆佺敱浜嶱HP灏嗚瘯鍥炬壘鍑洪偅浜涢渶瑕佸皢鍏跺€兼彃鍏ュ埌鍙屽紩鍙峰唴鐨勫彉閲忥紝鎵€浠ヤ粠鐞嗚涓婅锛屼娇鐢ㄥ崟寮曞彿瑕佸揩涓€浜涖€備絾鏄紝濡傛灉闇€瑕佹墦鍗颁竴涓彉閲忕殑鍊硷紝鍒欏繀椤讳娇鐢ㄥ弻寮曞彿銆?/p>

2銆佸洜涓烘湁鏁堢殑HTML甯稿父鍖呮嫭璁稿鐢ㄥ弻寮曞彿鎷綇鐨勫睘鎬э紝鎵€浠ュ綋鍒╃敤PHP鎵撳嵃HTML鏃讹紝浣跨敤鍗曞紩鍙锋渶瀹规槗銆?/p>

echo '

';

濡傛灉鎯充娇鐢ㄥ弻寮曞彿鎵撳嵃鍑轰笂闈㈣繖娈礖TML浠g爜锛屽皢涓嶅緱涓嶅瀛楃涓蹭腑鐨勬墍鏈夊弻寮曞彿杩涜杞箟锛屾墍浠ョ浉瀵规潵璇磋緝楹荤儲銆?/p>

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477260.htmlTechArticlePHP鍗曞紩鍙峰強鍙屽紩鍙峰潎鍙互淇グ瀛楃涓茬被鍨嬬殑鏁版嵁锛屽鏋滀慨楗扮殑瀛楃涓蹭腑鍚湁鍙橀噺锛堜緥$name锛夛紱鏈€澶х殑鍖哄埆鏄細 鍙屽紩鍙蜂細鏇挎崲鍙橀噺鐨勫€硷紝鑰屽崟...
Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn