php smarty °²×° ¡¢ÅäÖá¢Ê¹Óà ¼°»º´æcacheµÄÅäÖÃʹÓÃ
cache ʹÓãº
cacheÅäÖãº
$smarty->cache_dir = "/caches/"; //»º´æĿ¼
$smarty->caching = true; //¿ªÆô»º´æ,ΪflaseµÄʱºî»º´æÎÞЧ
$smarty->cache_lifetime = 60; //»º´æʱ¼ä
cacheÇå³ýºÍʹÓãº
$smarty->display('cache.tpl', cache_id); //´´½¨´øIDµÄ»º´æ
cache.tpl //Ä£°åÎļþ
$smarty->clear_all_cache(); //Çå³ýËùÓлº´æ
$smarty->clear_cache('index.htm'); //Çå³ýindex.tplµÄ»º´æ
$smarty->clear_cache('index.htm',cache_id); //Çå³ýÖ¸¶¨idµÄ»º´æ
smarty °²×°ÅäÖà ˵Ã÷£º
ÏÂÔØsmarty½âѹ ½«libsĿ¼ copyµ½ÏîÄ¿Ö÷Ŀ¼Ï£¬ÖÁÉÙ½¨Á¢ÈçÏÂÈçÏÂÎļþ¼Ð£ºtemplates templates_c configs cache
index.php
<?php
include("libs/Smarty.class.php");
$smarty = new Smarty;
$smarty->template_dir = './templates/';
$smarty->compile_dir = './templates_c/';
$smarty->config_dir = './configs/';
$smarty->cache_dir = './cache/';
$smarty->caching = true;
$smarty->cache_lifetime = 60;
$smarty->left_delimiter = "<{";
$smarty->right_delimiter = "}>";
$smarty->assign("title", "À¬»ø");
$smarty->assign("content","²âÊÔÓõÄÍøÒ³ÄÚÈÝ00");
$smarty->display("index.tpl",cache_id);
?>
index.tplÄ£°åÎļþ
<html>
¡¡¡¡<head>
¡¡¡¡<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
¡¡¡¡<title><{$title}></title>
¡¡¡¡</head>
¡¡¡¡<body>
¡¡¡¡<{$content}>
¡¡¡¡</body>
¡¡¡¡</html>
Ïà¹ØÎĵµ£º
ÔÚÍùPHP SessionÀïÃæ±£´æÐÅϢ֮ǰ£¬ÐèÒªÊ×ÏÈʹÓÃsession_start()º¯ÊýÀ´Æô¶¯session,
Õâ¸öº¯Êý±ØÐëÔÚ<html>±êǩ֮ǰµ÷ÓᣴúÂëÈçÏ£º
<?php session_start(); ?>
<html>
<body>
</body>
</html>
ÔÚSessionÆô¶¯ÒԺ󣬿ÉÒÔʹÓÃPHP $_SESSION±äÁ¿À´»ñÈ¡ºÍÉèÖÃsession±äÁ¿£¬ÊµÀý´ú ......
ÍƼöСÇÉµÄ PHP ¿ò¼Ü
CodeIgniter ÊÇÒ»¸öСÇɵ«¹¦ÄÜÇ¿´óµÄ PHP ¿ò¼Ü£¬×÷Ϊһ¸ö¼òµ¥¶ø“ÓÅÑÅ”µÄ¹¤¾ß°ü£¬Ëü¿ÉÒÔΪ PHP ³ÌÐòÔ±½¨Á¢¹¦ÄÜÍêÉÆµÄ Web Ó¦ÓóÌÐò¡£Èç¹ûÄãÊÇÒ»¸öʹÓù²ÏíÖ÷»ú£¬²¢ÇÒΪ¿Í»§ËùÒªÇóµÄÆÚÏÞ¶ø·³ÄյĿª·¢ÈËÔ±£¬Èç¹ûÄãÒѾÑá¾ëÁËÄÇЩɵ´ó±¿´ÖµÄ¿ò¼Ü.
ÀïÃæ°üº¬ÁËÈÕ³£ËùÐèÒªµÄÀà¿â£¬´úÂ뾫¼ò¡£ºÜÊ ......
Óõ¥ÒýºÅ´úÌæË«ÒýºÅÀ´°üº¬×Ö·û´®£¬ÕâÑù×ö»á¸ü¿ìһЩ¡£ÒòΪPHP»áÔÚË«ÒýºÅ°üΧµÄ×Ö·û´®ÖÐËÑÑ°±äÁ¿£¬µ¥ÒýºÅÔò²»»á£¬×¢Ò⣺ֻÓÐechoÄÜÕâô×ö£¬ËüÊÇÒ»ÖÖ¿ÉÒ԰Ѷà¸ö×Ö·û´®µ±×÷²ÎÊýµÄ“º¯Êý”£¨Òë×¢£ºPHPÊÖ²áÖÐ˵echoÊÇÓïÑԽṹ£¬²»ÊÇÕæÕýµÄº¯Êý£¬¹Ê°Ñº¯Êý¼ÓÉÏÁËË«ÒýºÅ£©¡£
1¡¢Èç¹ûÄܽ«ÀàµÄ·½·¨¶¨Òå³Éstatic£¬¾Í¾¡Á¿¶¨Ò ......
¹ØÓÚÔÚAJAXÖÐGET»ØµÄResponseTextÖÐÎÄÂÒÂëµÄ×î¼ò½â¾ö°ì·¨
//Èç¹û´«ËͲÎÊýÊÇÖ±½Ó¸³ÓèµÄ£¬¾Í»á²úÉúÂÒÂë!
´úÂëÈçÏÂ:
http_request.open("POST",url,true);
http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http_request.send("action="+strName+"&val="+val); //Èç¹ûvalµÄ ......