PHPµÄ»ù´¡ÖªÊ¶
¿´ÁËЩPHPµÄ»ù´¡ÖªÊ¶£¬×Ô¼ºÔÚÕâÀï×ܽáÏ£º
1£¬ÔÚHTMLǶÈëPHP½Å±¾ÓÐÈýÖÖ°ì·¨£º
<script language="php">
//ǶÈ뷽ʽһ
echo("test");
</script>
<?
//ǶÈ뷽ʽ¶þ
echo "<br>test2";
?>
<?php
//ǶÈ뷽ʽÈý
echo "<br>test3";
?>
¡¡¡¡»¹ÓÐÒ»ÖÖǶÈ뷽ʽ£¬¼´Ê¹ÓúÍAspÏàͬµÄ±ê¼Ç<%%>£¬µ«ÒªÐÞ¸ÄPHP.ini Ïà¹ØÅäÖ㬲»ÍƼöʹÓá£
2,PHP×¢ÊÍ·Öµ¥ÐкͶàÐÐ×¢ÊÍ£¬ºÍjava×¢ÊÍ·½Ê½Ïàͬ¡£
<?
//ÕâÀïÊǵ¥ÐÐ×¢ÊÍ
echo "test";
/*
ÕâÀïÊǶàÐÐ×¢ÊÍ£¡¿ÉÒÔдºÜ¶àÐÐ×¢ÊÍÄÚÈÝ
*/
?>
¡¡¡¡×¢Òâ²»ÒªÓÐǶÌ××¢ÊÍ£¬Èç/*aaaa/*asdfa*/asdfasdfas*/,ÕâÑùµÄ×¢ÊÍ»á³öÏÖÎÊÌâ¡£
3£¬PHPÖ÷ÒªµÄÊý¾ÝÀàÐÍÓÐ5ÖÖ£º
integer,double,string,array,object¡£
4£¬º¯ÊýÄÚµ÷Óú¯ÊýÍⲿ±äÁ¿£¬ÐèÒªÏÈÓÃglobal½øÐÐÉùÃ÷£¬·ñÔòÎÞ·¨·ÃÎÊ£¬ÕâÊÇPHPÓëÆäËû³ÌÐòÓïÑÔµÄÒ»¸öÇø±ð¡£ÊÂÀý´úÂ룺
<?
$a=1;
function test(){
echo $a;
}
test(); //ÕâÀォ²»ÄÜÊä³ö½á¹û“1”¡£
function test2(){
global $a;
echo $a;
}
test2(); //ÕâÑù¿ÉÒÔÊä³ö½á¹û“1”¡£
?>
¡¡¡¡×¢Ò⣺PHP¿ÉÒÔÔÚº¯ÊýÄÚ²¿ÉùÃ÷¾²Ì¬±äÁ¿¡£ÓÃ;ͬCÓïÑÔÖС£
5£¬±äÁ¿µÄ±äÁ¿£¬±äÁ¿µÄº¯Êý
<?
//±äÁ¿µÄ±äÁ¿
$a="hello";
$$a="world";
echo "$a $hello"; //½«Êä³ö"hello world"
echo "$a ${$a}"; //ͬÑù½«Êä³ö"hello world"
?>
<?
//±äÁ¿µÄº¯Êý
function func_1(){
print("test");
}
function fun($callback){
$callback();
}
fun("func_1"); //ÕâÑù½«Êä³ö"test"
?>
6£¬PHPͬʱ֧³Ö±êÁ¿Êý×éºÍ¹ØÁªÊý×飬¿ÉÒÔʹÓÃlist()ºÍarray()À´´´½¨Êý×é,Êý×éϱê´Ó0¿ªÊ¼¡£È磺
<?
$a[0]="abc";
$a[1]="def";
$b["foo"]=13;
$a[]="hello"; //$a[2]="hello"
$a[]="world"; //$a[3]="world"
$name[]="jill"; //$name[0]="jill"
$name[]="jack"; //$name[1]="jack"
?>
7£¬¹ØÁª²ÎÊý´«µÝ£¨&µÄʹÓã©£¬Á½ÖÖ·½·¨¡£Àý£º
<?
//·½·¨Ò»£º
function foo(&$bar){
$bar.=" and something extra";
}
$st
Ïà¹ØÎĵµ£º
ϵͳ¼°Èí¼þ°æ±¾
FreeBSD 7.3
Apache-2.2.14-5[ 1.3.42£¨Unix£©]
PHP-5.2.12
MySQL-5.0.90
Freebsdͨ¹ýport°²×°nginx
Nginx ("engine x") ÊÇÒ»¸ö¸ßÐÔÄÜµÄ HTTP ºÍ·´Ïò´úÀí·þÎñÆ÷£¬Ò²ÊÇÒ»¸ö IMAP/POP3/SMTP ´úÀí·þÎñÆ÷¡£ Nginx ÊÇÓÉ Igor Sysoev Ϊ¶íÂÞ˹·ÃÎÊÁ¿µÚ¶þµÄ Rambler.ru Õ¾µã¿ª·¢µÄ£¬ËüÒѾÔÚ¸ÃÕ¾µãÔËÐг¬¹ýÁ½ ......
ÓÃPHP±à³Ì£¬Ê¹Óûñȡʱ¼äµÄ´úÂ룬µ«ÊÇ»ñÈ¡µ½µÄʱ¼ä×ÜÊDZȵ±Ç°Ê±¼äÔç8¸öСʱ£¬°Ù˼²»µÃÆä½â£¬ÔÚÍøÉÏËÑË÷ÁËÏ£¬ÖÕÓÚÕÒµ½Á˽â¾ö°ì·¨£¬ÔÀ´ÊÇʱÇøÉèÖÃÎÊÌâ¡£ ½â¾ö°ì·¨Ò»£º ÔÚphp.iniÀïÉèÖà date.timezone = ʱÇø ½â¾ö°ì·¨¶þ£º ²»ÓÃÐÞ¸Äphp.inÎļþ£¬Ö±½ÓÔÚ»ñȡʱ¼äµÄ´úÂëÇ°Ãæ¼ÓÉÏ£º date_default_timezone_set('ʱÇø'); ±ÈÈ ......
<?php
$connstr="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . realpath("data.mdb");
$connid=odbc_connect($connstr,"","",SQL_CUR_USE_ODBC);
$issuetime=date("Y-m-d H:i:s");
$sql="insert into test values("","",...)";
$result=odbc_exec($connid,$sql);
if($result) echo "successful";
else ec ......
¡¾1¡¿Ò³ÃæÖ®¼äÎÞ·¨´«µÝ±äÁ¿ get,post,sessionÔÚ×îеÄphp°æ±¾ÖÐ×Ô¶¯È«¾Ö±äÁ¿Êǹرյģ¬ËùÒÔÒª´ÓÉÏÒ»Ò³ÃæÈ¡µÃÌá½»¹ýÀ´µÃ±äÁ¿ÒªÊ¹ÓÃ$_GET['foo'],$_POST['foo'],$_SESSION['foo']À´µÃµ½¡£µ±È»Ò²¿ÉÒÔÐÞ¸Ä×Ô¶¯È«¾Ö±äÁ¿Îª¿ª(php.ini¸ÄΪregister_globals = On)£»¿¼Âǵ½¼æÈÝÐÔ£¬»¹ÊÇÇ¿ÆÈ×Ô¼ºÊìϤеÄд·¨±È½ÏºÃ¡£
¡¡¡¡¡¾2¡¿Wi ......
1.°²×°apache2.0
¡¡¡¡sudo apt-get install apache2
¡¡¡¡°²×°ºóÔÚä¯ÀÀÆ÷Öдò¿ª£º
¡¡
¡¡http://localhost/»òÕßhttp://127.0.0.1
¡¡¡¡Èç¹û³öÏÖIt works!£¬ÄÇÖ¤Ã÷°²×°³É¹¦¡£
¡¡
¡¡2.°²×°PHP
¡¡¡¡sudo apt-get install php
5 //°²×°PHP
5
¡¡
¡¡sudo apt-get install libapache2-mod-php5 //ÅäÖÃAPACHE+PHP
¡¡¡¡sud ......