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

PHP CookieÓëSession¿çÓò·ÃÎÊ¡¢´«µÝ


ÍíÉÏÌØÒ⻨Á˸öʱ¼ä£¬×Ô¼º¶¯ÊÖÊÔÁËÏ¡£
ÔÚÏîÄ¿ÖÐÒ»Ö±Åöµ½Cookie¿çÓò·ÃÎʼ°SessionId¿çÓò´«µÝÎÊÌâ
·¶Àý£º
index.php
<?php
include_once('a.php');
session_start();
$_SESSION['k'] = uniqid();
setcookie("sess", session_id(), time()+3600, "/", ".ipggg.com");
echo "index.php<br />\n";
echo $_SESSION['k'].'<br />';
echo "<mce:script src="http://www.ipggg.com/test/b.php" mce_src="http://www.ipggg.com/test/b.php"></mce:script>";
var_dump($_COOKIE);
echo "<br />\n";
?>
    
a.php
<?php
header('Content-type: text/html; charset=utf8');
/*
ÎÒ×¢Ê͵ôP3P»¹ÊÇ¿ÉÒÔ£¬ÄѵÀÊÇÒòΪÎÒRPÌ«¸ß£¿£¡
ÓÃIE7»òÕß»ðºü¶¼¿ÉÒÔ·ÃÎʵ½Öµ£»
ʹÓû·¾³Vista home + xampp-win32-1.7.1Ì××°
*/
//header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
/* memory_limitÊÇÉèÖÃPHPʹÓÃÄÚ´æʱ¿Õ¼ä£¬Ò»°ãÉèÖÃΪÄÚ´æµÄËÄ·ÖÖ®Ò»£¬Ó¦¸Ã¾Í²é²»¶àÁË¡£ */
@ini_set('memory_limit', '64M');
/* Ö¸¶¨»á»°Ä£¿éÊÇ·ñÔÚÇëÇó¿ªÊ¼Ê±×Ô¶¯Æô¶¯Ò»¸ö»á»°¡£Ä¬ÈÏΪ 0£¨²»Æô¶¯£©¡£ */
@ini_set('session.auto_start', 0);
/* ÒÔ·ÖÖÓÊýÖ¸¶¨»º³åµÄ»á»°Ò³ÃæµÄ´æ»îÆÚ£¬´ËÉ趨¶Ô nocache »º³å¿ØÖÆ·½·¨ÎÞЧ¡£Ä¬ÈÏΪ180 */
@ini_set('session.cache_expire', 180);
/* Ö¸¶¨ÊÇ·ñÆôÓÃ͸Ã÷ SID Ö§³Ö¡£Ä¬ÈÏΪ 0£¨½ûÓã©¡£
°üº¬×ŻỰÃûÒÔ¼°»á»° ID µÄ³£Á¿£¬¸ñʽΪ "name=ID"£¬»òÕßÈç¹û»á»° ID ÒѾ­ÔÚÊʵ±µÄ»á»° cookie ÖÐÉ趨ʱÔòΪ¿Õ×Ö·û´®¡£ */
@ini_set('session.use_trans_sid', 0);
/* Ö¸¶¨ÊÇ·ñÔÚ¿Í»§¶ËÓà cookie À´´æ·Å»á»° ID¡£Ä¬ÈÏΪ 1£¨ÆôÓã©¡£ */
@ini_set('session.use_cookies', 0);
/* ±êÖ¾×Å×÷Ϊ·ÃÎʵÄCookieÖ»ÄÜͨ¹ýHTTPЭÒé¡£²»¹ýʹÓÃAJAXÓÃPHP·ÃÎʾͿɣ¬´¿JavaScriptÎÞЧ£¡Ö»ÄÜ·À·¶Ò»µãµã£¬¶øÇÒ²»ÊÇËùÓÐä¯ÀÀÆ÷¶¼Ö§³Ö¡£ */
@ini_set("session.cookie_httponly", 1);
/* Õâ¸öÓ¦¸Ã²»Óöà˵£¬PHP´íÎó¿ª¹Ø */
@ini_set('display_errors', 1);
?>

b.php
<?php
include_once('a.php');
session_id($_COOKIE['sess']);
session_start();
setcookie("test", $_SESSION['k'], time()+3600, "/", ".ipggg.com");
?>

ÉèÖÃC:\WINDOWS\system32\drivers\etc\hosts
ÒýÓÃ
127.0.0.1 


Ïà¹ØÎĵµ£º

PHPÄ£°åÒýÇæSmarty»º´æÓ¦ÓÃ

1£ºsmarty »º´æµÄÅäÖÃ
      
Php´úÂë
$smarty->cache_dir = "/caches/"; //»º´æĿ¼
$smarty->caching = true; //¿ªÆô»º´æ,ΪflaseµÄʱºî»º´æÎÞЧ
$smarty->cache_lifetime = 60; //»º´æʱ¼ä
2:smarty»º´æµÄʹÓúÍÇå³ý
   
Php´úÂë
$smarty->di ......

PHP»ñȡʱ¼ä´íÎóµÄÐÞÕý·½·¨

PHP»ñȡʱ¼ä´íÎóµÄÐÞÕý·½·¨
   ½ñÌìÔËÐÐPHP³ÌÐòµÄʱºò£¬ºÜÆæ¹Ö£¬ÎªÊ²Ã´PHP»ñÈ¡µÄʱ¼ä±Èʵ¼Êʱ¼äÕûÕûÉÙÁË8Сʱ£¬ÒÔǰҲûעÒâÕâ¸öÎÊÌ⣬×ÜÒÔΪÊÇʱ¼äÏÔʾ´íÁË£¬ÊÇ°²×°Èí¼þµÄÎÊÌ⣬½ñÌìÔÚÍøÉϲéÁËÏÂ×ÊÁÏ£¬Ô­À´ÁíÓÐÔ­Òò¡£
   ÆäʵÕâºÍʱÇøÓйأ¬PHPĬÈÏ»ñÈ¡0ʱÇø¿ªÊ¼µÄʱ¼ä£¬ÖйúÔÚ¶«°ËÇø£¬Òò´Ë£¬ÎÒÃÇÖÐ ......

phpͨÓüì²âº¯Êý¼¯

ÍøÉÏÕÒµ½µÄ£º¹²ÏíÒ»ÏÂ
<?
//¡¾¾¯¸æ¡¿:δ¾­Ðí¿ÉÇëÎðËæ±ãÐÞ¸Ä
//-----------------------------------------------------------------------------------
-------
//-----------------------------------------------------------------------------------
-------
//
// ¡¾ÎļþÃû¡¿: c_check.inc
// ¡¾× ......

php list·½·¨µÄÃîÓÃ

Ò»¸ö¼òµ¥µÄÀý×Ó¶ÁÈ¡CSVÎļþ£º
<?php
$handle=fopen("test.csv","r");
echo "<table border=2>";
//ÅäºÏwhileÑ­»·¶ÁÈ¡Îļþ
while($data=fgetcsv($handle,1024))
{
list($user,$pwd,$partment,$title)=$data;
echo "<tr>
<td>$user</td>
<td>$pwd< ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ