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
Ïà¹ØÎĵµ£º
dz̸PHPÓï·¨(1)
¡¡¡¡ÔÚÄãѧ¹ý»ù±¾µÄHTMLÓï·¨,¾Í¿ÉÒÔ±à³öÒ»¸ö¾²Ì¬µÄWebÒ³£¬¿É¶¯Ì¬½»»¥ÐÅÏ¢ÊǺÜÖØÒªµÄ¡£ÈçһЩÍøÕ¾µÄ»áÔ±ÖƵĻáÔ±×¢²á¡¢µÇ¼¶¼Ðèºó¶Ë³ÌÐòµÄÔËÐС£ºÜ¶àÍøÕ¾ËùÓõÄCGI³ÌÐòÖ÷ÒªÓÃPerl¡¢ASP¡¢Java¡¢PHP±àд£¬¶øÎÒÃÇÏÖÔÚËùÒªÓõľÍÊÇPHP¡£ËüÊÇÍêÈ«Ãâ·ÑµÄ£¬Õâ¾ÍÒª¸ÐлÄÇЩĬĬÎÞÎŵıà³ÌÈËÔ±ÁË¡£PHPµÄ½á¹¹ÀàËÆÓÚ£ ......
ÓÃ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 ......
¡¡¡¡¶ÔÓÚ³õѧPHPÓïÑÔµÄÅóÓÑÀ´Ëµ£¬PHP»¹ÓкܶණÎ÷ÐèÒªÉîÈëµÄ̽¾¿¡£Ö»ÓÐÔÚ²»¶ÏµÄÎÊÌâ´¦ÀíÖвÅÄÜÕÆÎÕÆäÖеÄÕæÖ¿¡£Ê²Ã´ÊÇPHPÎÞÏÞ·ÖÀàÄØ?¾ÍÏñwindowsÏÂн¨Ò»¸öÎļþ¼Ð£¬ÔÚн¨µÄÎļþ¼ÐÏÂÓÖ¿ÉÒÔн¨Ò»¸öÎļþ¼Ð£¬ÕâÑùÎÞÏÞÑ»·ÏÂÈ¥£¬ÎÞÏÞ·ÖÀàÒ²ÊÇÕâÑù£¬¸¸Àà¿ÉÒÔ·Ö³öËü×ÓÀ࣬×ÓÀàÓÖ¿ÉÒÔ·Ö³öËüµÄ×ÓÀ࣬ÕâÑùÒ»Ö±ÎÞÏÞÑ»·ÏÂÈ¥¡£
¡¡¡¡Ä ......