PHP¸ß¼¶Óï·¨£¨Èý£©—— ÃæÏò¶ÔÏó£¨ÖУ©
4 ·â×°
·â×°ÐÔÊÇÃæÏò¶ÔÏó±à³ÌÖеÄÈý´óÌØÐÔÖ®Ò»£¬·â×°ÐÔ¾ÍÊǰѶÔÏóµÄÊôÐԺͷþÎñ½áºÏ³ÉÒ»¸ö¶ÀÁ¢µÄÏàͬµ¥Î»£¬²¢¾¡¿ÉÄÜÒþ±Î¶ÔÏóµÄÄÚ²¿Ï¸½Ú£¬Ê¹¶à¸öϵͳģ¿é¶ÔÏóÐγÉÒ»¸öËÉñîºÏµÄ¹Øϵ¡£·â×°°üº¬Á½¸öº¬Òå:1.°Ñ¶ÔÏóµÄÈ«²¿ÊôÐÔºÍÈ«²¿·þÎñ½áºÏÔÚÒ»Æð£¬ÐγÉÒ»¸ö²»¿É·Ö¸îµÄ¶ÀÁ¢µ¥Î»£¨¼´¶ÔÏ󣩡£2.ÐÅÏ¢Òþ±Î£¬¼´¾¡¿ÉÄÜÒþ±Î¶ÔÏóµÄÄÚ²¿Ï¸½Ú£¬¶ÔÍâÐγÉÒ»¸ö±ß½ç¡²»òÕß˵ÐγÉÒ»µÀÆÁÕÏ¡³£¬Ö»±£ÁôÓÐÏ޵ĶÔÍâ½Ó¿Úʹ֮ÓëÍⲿ·¢ÉúÁªÏµ¡£
PHPʹÓÃprivate Õâ¸ö¹Ø¼ü×ÖÀ´¶ÔÊôÐԺͷ½·¨½øÐзâ×°£º
ÔÀ´µÄ³ÉÔ±:
var $name; //ÉùÃ÷È˵ÄÐÕÃû
var $sex; //ÉùÃ÷È˵ÄÐÔ±ð
var $age; //ÉùÃ÷È˵ÄÄêÁä
function run(){… … .}
¸Ä³É·â×°µÄÐÎʽ£º
private $name; //°ÑÈ˵ÄÐÕÃûʹÓÃprivate ¹Ø¼ü×Ö½øÐзâ×°
private $sex; //°ÑÈ˵ÄÐÔ±ðʹÓÃprivate ¹Ø¼ü×Ö½øÐзâ×°
private $age; //°ÑÈ˵ÄÄêÁäʹÓÃprivate ¹Ø¼ü×Ö½øÐзâ×°
private function run(){… … } //°ÑÈ˵Ä×ß··½·¨Ê¹ÓÃprivate ¹Ø¼ü×Ö½øÐзâ×°
×¢Ò⣺ֻҪÊdzÉÔ±ÊôÐÔÇ°ÃæÓÐÆäËüµÄ¹Ø¼ü×Ö¾ÍҪȥµôÔÓеĹؼü×Ö“var”¡£
ͨ¹ýprivate ¾Í¿ÉÒÔ°ÑÈ˵ijÉÔ±£¨³ÉÔ±ÊôÐԺͳÉÔ±·½·¨£©·â×°ÉÏÁË¡£·â×°ÉϵijÉÔ±¾Í²»Äܱ»ÀàÍâÃæµÄ¶ÔÏóÖ±½Ó·ÃÎÊÁË£¬Ö»ÓжÔÏóÄÚ²¿×Ô¼º¿ÉÒÔ·ÃÎÊ£»ÏÂÃæµÄ´úÂë»á²úÉú´íÎó£º
$p1=new Person();
echo $p1->name."<br>";
echo $p1->sex."<br>";
echo $p1->age."<br>";
$p1->run();
×¢Ò⣬ĬÈϵijÉÔ±ÊôÐÔ»ò·½·¨Êǹ«Óеģ¬ËùÒÔÎÒÃÇÔÚÀàµÄÍⲿµ÷ÓÃsay()·½·¨ÊÇ¿ÉÒԵġ£ÏÂÃæ¾Í¿´Ò»¸ö¹ØÓÚ·â×°ÐÔʵÀý£º
<?php
class Person
{
//ÏÂÃæÊÇÈ˵ijÉÔ±ÊôÐÔ
private $name; //È˵ÄÃû×Ö£¬±»private·â×°ÉÏÁË
private $sex; //È˵ÄÐÔ±ð, ±»private·â×°ÉÏÁË
private $age; //È˵ÄÄêÁä, ±»private·â×°ÉÏÁË
//¶¨ÒåÒ»¸ö¹¹Ôì·½·¨²ÎÊýΪ˽ÓеÄÊôÐÔÐÕÃû$name¡¢ÐÔ±ð$sexºÍÄêÁä$age½øÐи³Öµ
function __construct($name, $sex, $age)
{
//ͨ¹ý¹¹Ôì·½·¨´«½øÀ´µÄ$name¸ø˽ÓгÉÔ±ÊôÐÔ$this->name¸³³õʹֵ
$this->name=$name;
//ͨ¹ý¹¹Ôì·½·¨´«½øÀ´µÄ$sex¸ø˽ÓгÉÔ±ÊôÐÔ$this->sex¸³³õʹֵ
$this->sex=$sex;
//ͨ¹ý¹¹Ôì·½·¨´«½øÀ´µÄ$age¸ø˽ÓгÉÔ±ÊôÐÔ$this->age¸³³õʹֵ
$this->age=$age;
}
//Õâ¸öÈË¿ÉÒÔ˵»°µÄ·½·¨, ˵³ö×Ô¼ºµÄ˽ÓÐÊôÐÔ£¬ÔÚÕâÀïÒ²¿ÉÒÔ·ÃÎÊ˽Óз½·¨
function say()
{
echo "ÎÒµ
Ïà¹ØÎĵµ£º
ÒÔÏÂÊDZ¾È˵ÄÉèÖÃÎļþ£¬Ï£Íû¶Ô´ó¼ÒÓÐÓãº
£¨×¢£º°æ±¾ÎªVIM7ÒÔÉÏ£©
£¨ÔÙ×¢£ºCtrl+x,Ctrl+o×Ô¶¯²¹È«£»Ctrl+n±äÁ¿²¹È«£©
£¨¼ÌÐø×¢£ºÏȽ«Îļþ±£´æΪ.php²Å¿ÉʹÓÃ×Ô¶¯²¹È«£¬Èç¹ûÏë¸ü»»Óï·¨Ìáʾ£¬¿ÉÒÔÑ¡Ôñ“Óï·¨->Ôڲ˵¥ÖÐÏÔʾÎļþÀàÐÍ->ÏëÓõÄÓïÑÔ,¶àµÄÏÅÈË£©
ĬÈÏÖ§³ÖµÄÓïÑÔÌáʾÓÐ:
C,CSS,html,javascript,php, ......
3¡¢PHP°²×°
1£©»¹ÊÇÏÂÔØÔ´Âë°ü£¬È磺php-5.1.1.tar.gz£¬ÏÂÔصØÖ·£ºhttp://www.php.net
2£©½âѹËõ£¬>tar -zxvf php-5.1.1.tar.gz
3£©½øÈëphp-5.1.1£¬>cd php-5.1.1
4£©°²×°ÅäÖã¬>./configure --prefix=/opt/php
--with-apxs2=/opt/apache/bin/apxs --with-mysql=/opt/mysql
--with-mysqli=/opt/mysql/bin/ ......
Ò»¡¢¿´Êֲᣬ¿´ÊֲᣬÊÖ²á²ÅÊÇÍõµÀ£¬http://www.sphinxsearch.com/wiki/doku.php?id=sphinx_chinese_tutorial
¶þ¡¢±ÊÕß½¨Òé²ÉÓÃSphinxSE£¬²¿Êð·½±ã¼òµ¥£¬³ÌÐò¸Ä¶¯½ÏС£¬»ù±¾Ö÷Òª¸ü¸ÄsqlÓï¾ä¼´¿É
Èý¡¢Öصã˵Ã÷£º
1¡¢Èç¹ûÒªËÑË÷ÖÐÎÄ£¬ÔòÐèÔÚÅäÖÃÎļþconfÀïÖ¸¶¨×Ö·û²ÎÊý£¬eg£º
charset_table = U+FF10..U+FF19->0..9, ......
±íµ¥ºÍÓû§ÊäÈë
PHP ±íµ¥´¦Àí
±íµ¥ÊµÀý£º
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html> ......
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/02/01/1-8/
PHP²»Ìṩ¿ç½Å±¾µÄÈ«¾Ö±äÁ¿£¬µ«ÊÇ£¬ÒòΪʵ¼ÊµÄÐèÒª£¬PHPÌṩÁËһЩÌØÊâµÄÈ«¾Ö±äÁ¿ÓÃÀ´ÊµÏÖÕâЩ²Ù×÷¡£
$_GET[]£º½ÓÊÕÀ´×ÔÓû§ä¯ÀÀÆ÷ʹÓÃGET·½·¨·¢Ë͵ıäÁ¿µÄÊý×é
$_POST[]£º½ÓÊÕÀ´×ÔÓû§ä¯ÀÀÆ÷ʹÓÃPOST·½·¨·¢Ë͵ıäÁ¿µÄÊý×é
$_COOKIE[]£º ......