PHPѧϰ֮ PHP º¯Êý
PHP µÄÕæÕýÍþÁ¦Ô´×ÔÓÚËüµÄº¯Êý¡£
ÔÚ PHP ÖУ¬ÌṩÁ˳¬¹ý 700 ¸öÄÚ½¨µÄº¯Êý¡£
PHP º¯Êý
ÔÚ±¾½Ì³ÌÖУ¬ÎÒÃǽ«ÎªÄú½²½âÈçºÎ´´½¨×Ô¼ºµÄº¯Êý¡£
ÈçÐèÄÚ½¨º¯ÊýµÄ²Î¿¼ºÍʵÀý£¬Çë·ÃÎÊÎÒÃÇµÄ PHP ²Î¿¼Êֲᡣ
´´½¨ PHP º¯Êý
º¯ÊýÊÇÒ»ÖÖ¿ÉÒÔÔÚÈκα»ÐèÒªµÄʱºòÖ´ÐеĴúÂë¿é¡£
´´½¨ PHP º¯Êý£º
ËùÓеĺ¯Êý¶¼Ê¹Óùؼü´Ê "function()" À´¿ªÊ¼
ÃüÃûº¯Êý - º¯ÊýµÄÃû³ÆÓ¦¸ÃÌáʾ³öËüµÄ¹¦ÄÜ¡£º¯ÊýÃû³ÆÒÔ×Öĸ»òÏ»®Ïß¿ªÍ·¡£
Ìí¼Ó "{" - ¿ª¿ÚµÄ»¨À¨ºÅÖ®ºóµÄ²¿·ÖÊǺ¯ÊýµÄ´úÂë¡£
²åÈ뺯Êý´úÂë
Ìí¼ÓÒ»¸ö "}" - º¯Êýͨ¹ý¹Ø±Õ»¨À¨ºÅÀ´½áÊø¡£
Àý×Ó
Ò»¸ö¼òµ¥µÄº¯Êý£¬ÔÚÆä±»µ÷ÓÃʱÄÜÊä³öÎÒµÄÃû³ÆµÄ£º
<html>
<body>
<?php
function writeMyName()
{
echo "David Yang";
}
writeMyName();
?>
</body>
</html>
ʹÓà PHP º¯ÊýÏÖÔÚ£¬ÎÒÃÇÒªÔÚ PHP ½Å±¾ÖÐʹÓÃÕâ¸öº¯ÊýÁË£º<html>
<body>
<?php
function writeMyName()
{
echo "David Yang";
}
echo "Hello world!<br />";
echo "My name is ";
writeMyName();
echo ".<br />That's right, ";
writeMyName();
echo " is my name.";
?>
</body>
</html>
ÒÔÉÏ´úÂëµÄÊä³ö£º
Hello world!
My name is David Yang.
That's right, David Yang is my name.
PHP º¯Êý - Ìí¼Ó²ÎÊýÎÒÃǵĵÚÒ»¸öº¯ÊýÊÇÒ»¸ö·Ç³£¼òµ¥µÄº¯Êý¡£ËüÖ»ÄÜÊä³öÒ»¸ö¾²Ì¬µÄ×Ö·û´®¡£Í¨¹ý¿ÉÒÔÌí¼Ó²ÎÊý£¬ÎÒÃÇÏòº¯ÊýÌí¼Ó¸ü¶àµÄ¹¦ÄÜ¡£²ÎÊýÀàËÆÒ»¸ö±äÁ¿¡£Äú¿ÉÄÜ×¢Òâµ½ÁË£¬º¯ÊýÃû³ÆºóÃæÓÐÒ»¸öÀ¨ºÅ£¬±ÈÈç writeMyName()¡£²ÎÊý¾ÍÊÇÔÚÀ¨ºÅÖй涨µÄ¡£Àý×Ó 1ÏÂÃæµÄÀý×Ó½²Êä³ö²»Í¬µÄÃû×Ö£¬µ«ÐÕÊÇÏàͬµÄ£º<html>
<body>
<?php
function writeMyName($fname)
{
echo $fname . " Yang.<br />";
}
echo "My name is ";
writeMyName("David");
echo "My name is ";
writeMyName("Mike");
echo "My name is ";
writeMyName("John");
?>
</body>
</html>
ÉÏÃæµÄ´úÂëµÄÊä³ö£º
My name is David Yang.
My name is Mike Yang.
My name is John Yang.
Àý×Ó 2
ÏÂÃæµÄº¯ÊýÓÐÁ½¸ö²ÎÊý£º
<html>
<body>
<?php
function writeMyName($fname,$punctuation)
{
echo $fname . " Yang" . $punctuation . "<br />";
}
echo "My name is ";
writeMyName("David",".");
echo
Ïà¹ØÎĵµ£º
ÔÚhead.htmÖмÓÈ룬Ҳ¾ÍÊÇÔÚĬÈÏÄ£°æÖÐÌí¼Ó“$stime=microtime(true); //»ñÈ¡³ÌÐò¿ªÊ¼Ö´ÐеÄʱ¼ä”
¾ä
<!--<?php
$stime=microtime(true); //»ñÈ¡³ÌÐò¿ªÊ¼Ö´ÐеÄʱ¼ä
$GuideFid[$fid]=str_replace("<a href='$webdb[www_url]' class='guide_menu'>>Ê×Ò³</a>","",$GuideFid[$fid]);
$f ......
¸ù¾ÝÄãµÄʹÓÃÄ¿µÄÎÒ¾õµÃÕâ¸öº¯ÊýÓÐÁ½·½ÃæµÄÓÃ;£º
·ÀÖ¹SQL Injection¹¥»÷£¬Ò²¾ÍÊÇÄã±ØÐëÑéÖ¤Óû§µÄÊäÈë
²Ù×÷Êý¾ÝµÄʱºò±ÜÃâ²»±ØÒªµÄ×Ö·ûµ¼Ö´íÎó
mysql_real_escape_string() º¯ÊýתÒå SQL Óï¾äÖÐʹÓõÄ×Ö·û´®ÖеÄÌØÊâ×Ö·û¡£
ÏÂÁÐ×Ö·ûÊÜÓ°Ï죺
\x00
\n
\r
\
'
"
\x1a
Èç¹û³É¹¦£¬Ôò¸Ãº¯Êý·µ»Ø±»×ªÒåµÄ×Ö·û´ ......
Ä¿Ç°LAMP (Linux + Apache + MySQL + PHPspan style="font-family: Verdana;">) ½ü¼¸ÄêÀ´·¢Õ¹Ñ¸ËÙ£¬ÒѾ³ÉΪWeb ·þÎñÆ÷µÄÊÂʵ±ê×¼¡£LAMPÕâ¸ö´ÊµÄÓÉÀ´×îÔçʼÓڵ¹úÔÓÖ¾“c't Mag
azine”£¬Michael KunzeÔÚ1990Äê×îÏÈ°ÑÕâЩÏîÄ¿×éºÏÔÚÒ»Æð´´ÔìÁËLAMPµÄËõд×Ö¡£ÕâЩ×é¼þËäÈ»²¢²»ÊÇ¿ª¿ªÊ¼¾ÍÉè¼ÆΪһÆðʹ ......
»ù±¾µÄ PHP Óï·¨
PHP µÄ½Å±¾¿éÒÔ <?php ¿ªÊ¼£¬ÒÔ ?> ½áÊø¡£Äú¿ÉÒÔ°Ñ PHP µÄ½Å±¾¿é·ÅÖÃÔÚÎĵµÖеÄÈκÎλÖá£
µ±È»£¬ÔÚÖ§³Ö¼òдµÄ·þÎñÆ÷ÉÏ£¬Äú¿ÉÒÔʹÓà <? ºÍ ?> À´¿ªÊ¼ºÍ½áÊø½Å±¾¿é¡£
²»¹ý£¬ÎªÁË´ïµ½×îºÃµÄ¼æÈÝÐÔ£¬ÎÒÃÇÍƼöÄúʹÓñê×¼ÐÎʽ (<?php)£¬¶ø²»ÊǼòдÐÎʽ¡£
<?php
?>
PHP Îļþͨ³£»á°ü ......
±äÁ¿ÓÃÓÚ´æ´¢Öµ£¬±ÈÈçÊý×Ö¡¢×Ö·û´®»òº¯ÊýµÄ½á¹û£¬ÕâÑùÎÒÃǾͿÉÒÔÔڽű¾Öжà´ÎʹÓÃËüÃÇÁË¡£
PHP ÖеıäÁ¿
±äÁ¿ÓÃÓÚ´æ´¢Öµ£¬±ÈÈçÊý×Ö¡¢Îı¾×Ö·û´®»òÊý×é¡£
Ò»µ©ÉèÖÃÁËij¸ö±äÁ¿£¬ÎÒÃǾͿÉÒÔÔڽű¾ÖÐÖظ´µØʹÓÃËü¡£
PHP ÖеÄËùÓбäÁ¿¶¼ÊÇÒÔ $ ·ûºÅ¿ªÊ¼µÄ¡£
ÔÚ PHP ÖÐÉèÖñäÁ¿µÄÕýÈ··½·¨ÊÇ£º
$var_name = value;
PHP ......