php ÖеÄÅÐ¶Ï ×ܽá
<?php
/* Åжϳ£Á¿ÊÇ·ñ´æÔÚ*/
if (defined('MYCONSTANT')) {
echo MYCONSTANT;
}
//ÅжϱäÁ¿ÊÇ·ñ´æÔÚ
if (isset($myvar)) {
echo "´æÔÚ±äÁ¿$myvar.";
}
//ÅжϺ¯ÊýÊÇ·ñ´æÔÚ
if (function_exists('imap_open')) {
echo "´æÔÚº¯Êýimag_open\n";
} else {
echo "º¯Êýimag_open²»´æÔÚ\n";
}
//ÅжÏÀàÊÇ·ñ´æÔÚ
if (class_exists('MyClass')) {
$myclass = new MyClass();
}
//ÅжÏÎļþÊÇ·ñ´æÔÚ
$filename = '/path/to/foo.txt';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
//ÅжÏÊý×éÖÐÊÇ·ñ´æÔÚij³ÉÔ±
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
}
//ÅжϱäÁ¿ÀàÐÍ
is_array()
is_bool()
is_float()
is_integer()
is_null()
is_numeric()
is_object()
is_resource()
is_scalar()
is_string()
?>
Ïà¹ØÎĵµ£º
<?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ÏÂн¨Ò»¸öÎļþ¼Ð£¬ÔÚн¨µÄÎļþ¼ÐÏÂÓÖ¿ÉÒÔн¨Ò»¸öÎļþ¼Ð£¬ÕâÑùÎÞÏÞÑ»·ÏÂÈ¥£¬ÎÞÏÞ·ÖÀàÒ²ÊÇÕâÑù£¬¸¸Àà¿ÉÒÔ·Ö³öËü×ÓÀ࣬×ÓÀàÓÖ¿ÉÒÔ·Ö³öËüµÄ×ÓÀ࣬ÕâÑùÒ»Ö±ÎÞÏÞÑ»·ÏÂÈ¥¡£
¡¡¡¡Ä ......
¿´ÁËЩPHPµÄ»ù´¡ÖªÊ¶£¬×Ô¼ºÔÚÕâÀï×ܽáÏ£º
1£¬ÔÚHTMLǶÈëPHP½Å±¾ÓÐÈýÖÖ°ì·¨£º
<script language="php">
//ǶÈ뷽ʽһ
echo("test");
</script>
<?
//ǶÈ뷽ʽ¶þ
echo "<br>test2";
?>
<?php
//ǶÈ뷽ʽÈý
echo "<br>test3";
?>
¡¡¡¡»¹ÓÐÒ»ÖÖǶÈ뷽ʽ£¬¼´Ê¹Óà ......
ÎÞÂÛÄÄÖÖÓïÑÔ£¬×Ö·û´®²Ù×÷¶¼ÊÇÒ»¸öÖØÒªµÄ»ù´¡£¬ÍùÍùÊǼòµ¥¶øÖØÒª¡£ÕýÏñÈË˵»°Ò»Ñù£¬Ò»°ãÓÐÐÎÌ壨ͼÐνçÃ棩£¬ÓÐÓïÑÔ£¨print ×Ö·û´®£¿£©£¬ÏÔÈ»×Ö·û´®ÄܽâÊ͸ü¶àµÄ¶«Î÷¡£PHPÌṩÁË´óÁ¿µÄ×Ö·û´®²Ù×÷º¯Êý£¬¹¦ÄÜÇ¿´ó£¬Ê¹ÓÃÒ²±È½Ï¼òµ¥£¬ÏêϸÇë²Î¿´ http://cn2.php.net/manual/zh/ref.strings.php . ÒÔϽ«¼òµ¥µÄ½²ÊöËüµÄ¹¦ÄܺÍÌØÐ ......
ÊôÐÔÃû³Æ£ºfrom£¬item,key,name
×¢Ò⣺
1,fromºÍitemÊDZØÒªÊôÐÔ
2,{foreach}Ñ»·µÄname¿ÉÒÔÊÇÈκÎ×Öĸ£¬Êý×飬Ï»®ÏßµÄ×éºÏ£¬²Î¿¼PHP±äÁ¿¡£
3,{foreach}Ñ»·¿ÉÒÔǶÌ×£¬Ç¶Ì×µÄ{foreach}µÄÃû³ÆÓ¦µ±»¥²»Ïàͬ¡£
ÎļþÒ»£ºindex.tpl
<b>ÏÂÃæµÄÊý¾Ý·Ö±ðÊÇ£º</b>
<ul>
{foreach from=$myArray1 key=k ite ......