Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

PHP smarty foreachÓ÷¨£¡

ÊôÐÔÃû³Æ£º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 item=foo}
<li>{$k+1}:{$foo}</li>
{/foreach}
</ul>
<ul>
{foreach from=$myArray2 key=k item=v}
<li>{$k}: {$v}</li>
{/foreach}
</ul>
<ul>
{foreach from=$myArray3 key=myId item=i}
<li><a href="item.php?id={$myId}" mce_href="item.php?id={$myId}">{$i.no}: {$i.label}</li>
{/foreach}
</ul>

Îļþ¶þ£ºindex.php
<?php
require 'Smarty.class.php';
$smarty = new Smarty;
$smarty->assign('myArray1', array("ÐÇÆÚÒ»", "ÐÇÆÚ¶þ", "ÐÇÆÚÈý"));
$smarty->assign('myArray2', array("Öйú" => 'China', "Ó¢¹ú" => 'England', "¶í¹ú" => 'Russia'));
$smarty->assign('myArray3', array(23 => array('no' => 2456, 'label' => 'Salad'),96 => array('no' => 4889, 'label' => 'Cream')));
$smarty->display('index.tpl');
?>


Ïà¹ØÎĵµ£º

php ѧϰ¼Ç¼

dir() º¯Êý´ò¿ªÒ»¸öĿ¼¾ä±ú£¬²¢·µ»ØÒ»¸ö¶ÔÏó¡£Õâ¸ö¶ÔÏó°üº¬Èý¸ö·½·¨£ºread() , rewind() ÒÔ¼° close()¡£
Èô³É¹¦£¬Ôò¸Ãº¯Êý·µ»ØÒ»¸öĿ¼Á÷£¬·ñÔò·µ»Ø false ÒÔ¼°Ò»¸ö error¡£¿ÉÒÔͨ¹ýÔÚº¯ÊýÃûÇ°¼ÓÉÏ "@" À´Òþ²Ø error µÄÊä³ö¡£
<?php
//´ò¿ª images Ŀ¼
$dir = dir("images");
//Áгö images Ŀ¼ÖеÄÎļþ
while ......

PHPѧϰ±Ê¼Ç

    ½ñÌ쿪ʼѧϰPHP£¬¸Ð¾õ¿´¹ý¾ÍÍüÁË£¬É¶¶¼Áô²»Ï±ȽÏÒź¶£¬¾Í±ß¿´±ß×ܽáÁË£¬·½±ã×Ô¼ºÒÔºó¿´£¬Ò²·½±ã±ðÈË¿ìËÙÈëÃÅ£¬»òÕß¿ìËÙ¸´Ï°°É(awen)¡£
 
µÚÒ»²¿·Ö ´î½¨Æ½Ì¨
1.    ¿ÉÒÔÏÂÔØÒ»¸öphp for windows iis °æ±¾ ×îÊ¡¾¢£¬Ö±½Ó°²×°ºó×Ô¶¯Éý¼¶iisʹÆäÖ§³Öphp¹¦ÄÜ¡£
2.    ......

PHPÎÞÏÞ·ÖÀàµÄ¾ßÌåÔ­Àí·ÖÎö

¡¡¡¡¶ÔÓÚ³õѧPHPÓïÑÔµÄÅóÓÑÀ´Ëµ£¬PHP»¹ÓкܶණÎ÷ÐèÒªÉîÈëµÄ̽¾¿¡£Ö»ÓÐÔÚ²»¶ÏµÄÎÊÌâ´¦ÀíÖвÅÄÜÕÆÎÕÆäÖеÄÕæÖ¿¡£Ê²Ã´ÊÇPHPÎÞÏÞ·ÖÀàÄØ?¾ÍÏñwindowsÏÂн¨Ò»¸öÎļþ¼Ð£¬ÔÚн¨µÄÎļþ¼ÐÏÂÓÖ¿ÉÒÔн¨Ò»¸öÎļþ¼Ð£¬ÕâÑùÎÞÏÞÑ­»·ÏÂÈ¥£¬ÎÞÏÞ·ÖÀàÒ²ÊÇÕâÑù£¬¸¸Àà¿ÉÒÔ·Ö³öËü×ÓÀ࣬×ÓÀàÓÖ¿ÉÒÔ·Ö³öËüµÄ×ÓÀ࣬ÕâÑùÒ»Ö±ÎÞÏÞÑ­»·ÏÂÈ¥¡£
¡¡¡¡Ä ......

PHPµÄ»ù´¡ÖªÊ¶

¿´ÁËЩPHPµÄ»ù´¡ÖªÊ¶£¬×Ô¼ºÔÚÕâÀï×ܽáÏ£º
1£¬ÔÚHTMLǶÈëPHP½Å±¾ÓÐÈýÖÖ°ì·¨£º
<script language="php">
//ǶÈ뷽ʽһ
echo("test");
</script>
<?
//ǶÈ뷽ʽ¶þ
echo "<br>test2";
?>
<?php
//ǶÈ뷽ʽÈý
echo "<br>test3";
?>
¡¡¡¡»¹ÓÐÒ»ÖÖǶÈ뷽ʽ£¬¼´Ê¹Óà ......

php µ÷ÓÃmssql´æ´¢¹ý³ÌʵÀýÓ¦ÓÃ

php½Ì³Ì µ÷ÓÃmssql´æ´¢¹ý³ÌʵÀýÓ¦ÓÃ
ÓÃmssql_initÓï¾äÓÃÓÚ³õʼ»¯´æ´¢¹ý³Ì£¬¶øºóµ÷ÓÃmssql_bindÓï¾äÖ¸¶¨´æ´¢¹ý³Ì²ÎÊý£¬×îºóµ÷ÓÃmssql_executeÖ´Ðд洢¹ý³Ì¡£
*/
//Á¬½ÓmssqlÊý¾Ý¿â½Ì³Ì·þÎñÆ÷
 $link = mssql_connect("127.0.0.1", "sa", "sa") or die("Can't connect sql server");
    mssql_sele ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ