Ò»¸ö±È½ÏÍêÉÆµÄPHP¹ºÎï³µÀà
<?
/*****************************************************************************/
/* */
/* file type: °üº¬Îļþ£¬½¨Òéºó׺Ϊ.inc */
/* */
/* file name: cart.inc */
/* */
/* Description: ¶¨ÒåÒ»¸ö¹º³µÀà */
/* */
/* Func list : class cart */
/* */
/* author : bigeagle */
/* */
/* date : 2000/12/24 */
/* */
/* History: 2000/12/24 finished */
/* */
/*****************************************************************************/
//¶¨Òå±¾Îļþ³£Á¿
define("_CART_INC_" , "exists") ;
/*¹ºÎï³µÀà*/
class TCart
{
var $SortCount; //ÉÌÆ·ÖÖÀàÊý
var $TotalCost; //ÉÌÆ·×ܼÛÖµ
var $Id; //ÿÀàÉÌÆ·µÄID£¨Êý×飩
var $Name; //ÿÀàÉÌÆ·µÄÃû³Æ£¨Êý×飩
var $Price; //ÿÀàÉÌÆ·µÄ¼Û¸ñ£¨Êý×飩
var $Discount; //ÉÌÆ·µÄÕÛ¿Û£¨Êý×飩
var $GoodPrice ; //ÉÌÆ·µÄÓŻݼ۸ñ£¨Êý×飩
var $Count; //ÿÀàÉÌÆ·µÄ¼þÊý£¨Êý×飩
var $MaxCount ; //ÉÌÆ·ÏÞÁ¿£¨Êý×飩
//******¹¹Ô캯Êý
function TCart()
{
$this->SortCount=0;
session_start(); //³õʼ»¯Ò»¸ösession
session_register('sId');
session_register('sName');
session_register('sPrice');
session_register('sDiscount');
session_register('sGoodPrice') ;
session_register('sCount') ;
session_register('sMaxCount') ;
$this->Update();
$this->Calculate();
}
//********˽ÓУ¬¸ù¾ÝsessionµÄÖµ¸üÐÂÀàÖÐÏàÓ¦Êý¾Ý
function Update()
{
global $sId,$sName,$sPrice,$sCount,$sDiscount,$sMaxCount,$sGoodPrice;
if(!isset($sId) or !isset($sName) or !isset($sPrice)
or !isset($sDiscount) or !isset($sMaxCount)
or !isset($sGoodPrice) or !isset($sCount)) return;
$this->Id =$sId;
$this->Name =$sName;
$this->Price =$sPrice;
$this->Count =$sCount;
$this->Discount = $sDiscount ;
$this->GoodPrice = $sGoodPrice ;
$this->MaxCount = $sMaxCount ;
//¼ÆËãÉÌÆ·×ÜÊý
$this->SortCount=count($sId);
}
//********˽ÓУ¬¸ù¾ÝеÄÊý¾Ý¼ÆËãÿÀàÉÌÆ·µÄ¼ÛÖµ¼°È«²¿ÉÌÆ·µÄ×ܼÛ
function Calculate()
{
for($i=0;$i<$this->SortCount;$i++)
{
/*¼ÆËãÿ¼þÉÌÆ·µÄ¼ÛÖµ£¬Èç¹ûÕÛ¿ÛÊÇ
Ïà¹ØÎĵµ£º
ÎÒʹÓÃWAMP5 version 1.7.4°²×°PHP+Apache+MySQL¼¯³É»·¾³£¬ÔÚµ÷ÊÔÒ»¸ö³ÌÐòʱ£¬ÆäÑéÖ¤Âë²»ÄÜÏÔʾ£¬ÊÔÁ˺öà´Î£¬ÐÞ¸ÄÁËºÜ¶àµØ·½Ò²Ã»Äܳɹ¦¡£ÒÑ×öºÃµÄÅäÖÃÈçÏ£º
¢ÙÔÚphpinfÒ³ÃæLoaded Configuration FileºóÃæËùÖ¸¶¨µÄphp.iniÖаÑ;extension=php_gd2.dllÇ°ÃæµÄ;È¥µô¡£
¢ÚÖØÆôÁËApache·þÎñÆ÷¡£
Âé· ......
1£¬Notice: Undefined variable½â¾ö°ì·¨
PHPĬÈÏÅäÖûᱨÕâ¸ö´íÎó£¬ÎÒµÄPHP°æ±¾ÊÇ5.2.9-1,´æÔÚÕâ¸öÎÊÌ⣺
Notice: Undefined variable
Õâ¾ÍÊǽ«¾¯¸æÔÚÒ³ÃæÉÏ´òÓ¡³öÀ´£¬ËäÈ»ÕâÊÇÓÐÀûÓÚ±©Â¶ÎÊÌ⣬µ«ÊµÏÖʹÓÃÖÐ»á´æÔںܶàÎÊÌâ¡£
ÐèÒªÉèÖÃÏÔʾ´íÎó¼¶±ð£¬À´½â¾öÎÊÌâ¡£
ÍøÂçÉϵÄͨÓýâ¾ö°ì·¨ÊÇÐÞ¸Äphp.iniµÄÅäÖãº
½â¾ö·½·¨ ......
ÐèÒªÓõÄphpµÄÕý¹æÆ¥Å人×Ö£¬ÔÚÍøÉÏÕÒÁËЩÎÄÕ¿´ÁËÒÔÏ£¬¿´µ½Õâ¸öµÄʱºò¸Ð¾õÕâÆªÎÄÕÂдµÄºÜÕæÊµ£¬È̲»×¡×ª¹ýÀ´ÁË¡£
ÔÎĵØÖ·£ºhttp://hi.baidu.com/comdeng/blog/item/f272362e47ce29564ec226c5.html
ÔÚjavascriptÖУ¬ÒªÅжÏ×Ö·û´®ÊÇÖÐÎÄÊǺܼòµ¥µÄ¡£±ÈÈ磺
var str = "php±à³Ì";
if (/^[\u4e00-\u9fa5]+$/.t ......
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/01/27/1-3/
×òÌìÎÒÃÇʵÏÖÁËPHPµÄµÚÒ»¸öÒ³Ãæhello£¬world£¡
PHPµÄÓïÑÔ¹¹³ÉÓ빤×÷ÔÀíÊÇÊ²Ã´ÄØ£¿
ºê¹ÛµØ½«£ºÒ»¸öÍêÕûµÄPHP³ÌÐòÊÇÓÉÖ÷³ÌÐòºÍº¯Êý¹¹³É¡£PHP³ÌÐòµÄÖ´ÐдÓÖ÷³ÌÐò¿ªÊ¼£¬µ÷ÓÃÆäËûº¯Êýºó·µ»ØÖ÷³ÌÐò²¢½áÊø¡£
ÔÚPHPµÄÖ÷³ÌÐòºÍº¯ÊýÖУ¬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 ......