Smarty Ä£°å ´Óphp·ÖÅäµÄ±äÁ¿
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com',
array('555-444-3333',
'555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts[0]}<br>
{$Contacts[1]}<br>
{* you can print arrays of arrays as well *}
{$Contacts[2][0]}<br>
{$Contacts[2][1]}<br>
OUTPUT:
555-222-9876<br>
zaphod@slartibartfast.com<br>
555-444-3333<br>
555-111-1234<br>
Ïà¹ØÎĵµ£º
這個問題ÓÐ點Ææ¹Ö£¬ÔÚJavaºÍ.netµÄÊÀ½ç裡還δÅöµ½過.......
¿´來PHP對對ÏóµÄÖ§³Ö還²»ÊÇÌ«ÓѺ㬺ǺÇ~~~
[轉載ì¶£º] http://blog.csdn.net/yehell/archive/2007/12/19/1953826.aspx
½ñÌìÔÚphpÎļþÖÐÉèÖÃÁËÒ»¸ösession.²¢½«Ò»¸öÀ ......
1.»ù±¾Àà
//smarty_config.php
<?php
define('TEMPLATE_DIR','templates/');
define('COMPILE_DIR','templates_c/');
define('CONFIG_DIR','configs/');
define('CACHE_DIR','cache/');
?>
//View.class.php
<?php
//ÅäÖÃÎļþ
require_once 'configs/smart_config.php';
//SmartyÀà
require('smarty/ ......
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/01/26/1-2/
ËùÓбà³ÌÓïÑԵĿªÊ¼:Hello,world!Ò³Ãæ¡£
Ê×ÏÈʹÓÃhtml±àдһ¸ö¼òµ¥µÄÒ³Ãæ¡£´úÂëÈçÏ£º
<html>
<head>
<title>Hello, world</title>
</head>
<body>
<H1><p align=center>Hello, world</p></H1 ......
1£¬Notice: Undefined variable½â¾ö°ì·¨
PHPĬÈÏÅäÖûᱨÕâ¸ö´íÎó£¬ÎÒµÄPHP°æ±¾ÊÇ5.2.9-1,´æÔÚÕâ¸öÎÊÌ⣺
Notice: Undefined variable
Õâ¾ÍÊǽ«¾¯¸æÔÚÒ³ÃæÉÏ´òÓ¡³öÀ´£¬ËäÈ»ÕâÊÇÓÐÀûÓÚ±©Â¶ÎÊÌ⣬µ«ÊµÏÖʹÓÃÖÐ»á´æÔںܶàÎÊÌâ¡£
ÐèÒªÉèÖÃÏÔʾ´íÎó¼¶±ð£¬À´½â¾öÎÊÌâ¡£
ÍøÂçÉϵÄͨÓýâ¾ö°ì·¨ÊÇÐÞ¸Äphp.iniµÄÅäÖãº
½â¾ö·½·¨ ......
ÄÚÈÝÕªÒª£ºRSS ¾ÛºÏ×î½ü·Ç³£Á÷ÐУ¬Òò´ËÖÁÉÙ¶Ô RSS ¼°Æä¹¤×÷·½Ê½ÓÐËùÁ˽âÊÇÒ»Ãû PHP ¿ª·¢ÈËÔ±µÄÆÈÇÐÐèÒª¡£±¾ÎĽéÉÜÁË RSS »ù´¡ÖªÊ¶¡¢RSS ÖÚ¶àÓÃ;ÖеÄһЩÓÃ;¡¢ÈçºÎʹÓà PHP ´ÓÊý¾Ý¿â´´½¨ RSS ÌáÒª£¬ÒÔ¼°ÈçºÎʹÓà XML_RSS Ä£¿é¶ÁÈ¡ÏÖÓÐ RSS ÌáÒª²¢½«Æäת»»Îª HTML¡£
¡¡¡¡Ê²Ã´£¿ÄúûÌý˵¹ý RSS£¿
¡¡¡¡RSS ¾ÛºÏÊÇ×î³£¼ûµÄ ......