PHPѧϰ֮ PHP Óï·¨
»ù±¾µÄ PHP Óï·¨
PHP µÄ½Å±¾¿éÒÔ <?php ¿ªÊ¼£¬ÒÔ ?> ½áÊø¡£Äú¿ÉÒÔ°Ñ PHP µÄ½Å±¾¿é·ÅÖÃÔÚÎĵµÖеÄÈκÎλÖá£
µ±È»£¬ÔÚÖ§³Ö¼òдµÄ·þÎñÆ÷ÉÏ£¬Äú¿ÉÒÔʹÓà <? ºÍ ?> À´¿ªÊ¼ºÍ½áÊø½Å±¾¿é¡£
²»¹ý£¬ÎªÁË´ïµ½×îºÃµÄ¼æÈÝÐÔ£¬ÎÒÃÇÍÆ¼öÄúʹÓñê×¼ÐÎʽ (<?php)£¬¶ø²»ÊǼòдÐÎʽ¡£
<?php
?>
PHP Îļþͨ³£»á°üº¬ HTML ±êÇ©£¬¾ÍÏñÒ»¸ö HTML Îļþ£¬ÒÔ¼°Ò»Ð© PHP ½Å±¾´úÂë¡£
ÔÚÏÂÃæ£¬ÎÒÃÇÌṩÁËÒ»¶Î¼òµ¥µÄ PHP ½Å±¾£¬Ëü¿ÉÒÔÏòä¯ÀÀÆ÷Êä³öÎı¾ "Hello World"£º
<html>
<body>
<?php
echo "Hello World";
?>
</body>
</html>
PHP ÖеÄÿ¸ö´úÂëÐж¼±ØÐëÒԷֺŽáÊø¡£·ÖºÅÊÇÒ»ÖÖ·Ö¸ô·û£¬ÓÃÓÚ°ÑÖ¸Áî¼¯Çø·Ö¿ªÀ´¡£
ÓÐÁ½ÖÖͨ¹ý PHP À´Êä³öÎı¾µÄ»ù´¡Ö¸Áecho ºÍ print¡£ÔÚÉÏÃæµÄÀý×ÓÖУ¬ÎÒÃÇʹÓÃÁË echo Óï¾äÀ´Êä³öÎı¾ "Hello World"¡£
PHP ÖеÄ×¢ÊÍ
ÔÚ PHP ÖУ¬ÎÒÃÇʹÓà // À´±àдµ¥ÐÐ×¢ÊÍ£¬»òÕßʹÓà /* ºÍ */ À´±àд´óµÄ×¢ÊͿ顣
<html>
<body>
<?php
//This is a comment
/*
This is
a comment
block
*/
?>
</body>
</html>
Ïà¹ØÎĵµ£º
1.Èç¹ûÒ»¸ö·½·¨¿É¾²Ì¬»¯£¬¾Í¶ÔËü×ö¾²Ì¬ÉùÃ÷¡£ËÙÂÊ¿ÉÌáÉýÖÁ4±¶¡£
2.echo ±È print ¿ì¡£
3.ʹÓÃechoµÄ¶àÖØ²ÎÊý£¨Òë×¢£ºÖ¸ÓöººÅ¶ø²»ÊǾäµã£©´úÌæ×Ö·û´®Á¬½Ó¡£
4.ÔÚÖ´ÐÐforÑ»·Ö®Ç°È·¶¨×î´óÑ»·Êý£¬²»ÒªÃ¿Ñ»·Ò»´Î¶¼¼ÆËã×î´óÖµ¡£
5.×¢ÏúÄÇЩ²»ÓõıäÁ¿ÓÈÆäÊÇ´óÊý×飬ÒÔ±ãÊÍ·ÅÄÚ´æ¡£
6.¾¡Á¿±ÜÃâʹÓÃ__get£¬__set£¬__autolo ......
ÓöàÖÖ±à¼Èí¼þÐ޸ĹýµÄphpÍøÕ¾¿ÉÄÜ»áÓöµ½Ò»ºÜ¹ÖÎÊÌ⣺ÓÃincludeÒýÈëµÄfooterºÍheaderÎļþ¶¼ÔÚÉÏÃæ¶à³öÒ»¿Õ°×ÐУ¬Ö±½Ó°Ñ±»ÒýÈëµÄÎļþ·ÅÈëÔòûÎÊÌâ¡£Õâ¸öÎÊÌ⼫ÓпÉÄÜÊDZàÂëÎÊÌâÒýÆðµÄ¡£Èç¹û²ÉÓÃutf-8±àÂëÒªÉèÖÃΪÎÞbom£¬²¢ÇÒÒªËùÓеÄÉæ¼°µ½µÄÒ³Ãæ°üÀ¨css¼°ÆäËûÎļþ¶¼ÒªÒÔÎÞbomµÄutf-8±àÂë¡£¾ßÌå·½·¨¿ÉÒÔÊÇ£ºÔÚDreamweaverÀï ......
¸ù¾ÝÄãµÄʹÓÃÄ¿µÄÎÒ¾õµÃÕâ¸öº¯ÊýÓÐÁ½·½ÃæµÄÓÃ;£º
·ÀÖ¹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µÄËõд×Ö¡£ÕâЩ×é¼þËäÈ»²¢²»ÊÇ¿ª¿ªÊ¼¾ÍÉè¼ÆÎªÒ»Æðʹ ......
http://www.w3school.com.cn/php/php_intro.asp
ʲôÊÇ PHP£¿
PHP Ö¸ PHP:³¬Îı¾Ô¤´¦ÀíÆ÷£¨ÒëÕß×¢£ºPHP: Hypertext Preprocessor£¬µÝ¹éÃüÃû£©
PHP ÊÇÒ»ÖÖ·þÎñÆ÷¶ËµÄ½Å±¾ÓïÑÔ£¬ÀàËÆ ASP
PHP ½Å±¾ÔÚ·þÎñÆ÷ÉÏÖ´ÐÐ
PHP Ö§³ÖºÜ¶àÊý¾Ý¿â£¨MySQL¡¢Informix¡¢Oracle¡¢Sybase¡¢Solid¡¢PostgreSQL¡¢Generic ODBC µÈµÈ£©
PHP ÊÇÒ ......