php session_cache_limiter session_cache_expire等函數_PHP教程

來源:互聯網
上載者:User
session_cache_limiter() 返回當前緩衝限制的名字. 如果指定了 cache_limiter, 當前的緩衝限制的名字被改為新值. 緩衝限制控制著 HTTP 頭髮送到用戶端的緩衝控制. 這些確定頁面內容規則的頭內容可以被緩衝.如果設定緩衝設定為沒有緩衝(nocache), 將不允許任何用戶端緩衝. 但是公開變數可以允許緩衝. 他也可以設定為私人的,這個比公用的多一點限制.

string session_cache_limiter ([string cache_limiter])

session_cache_limiter() 返回當前緩衝限制的名字. 如果指定了 cache_limiter, 當前的緩衝限制的名字被改為新值.

緩衝限制控制著 http 頭髮送到用戶端的緩衝控制. 這些確定頁面內容規則的頭內容可以被緩衝.如果設定緩衝設定為沒有緩衝(nocache), 將不允許任何用戶端緩衝. 但是公開變數可以允許緩衝. 他也可以設定為私人的,這個比公用的多一點限制.

緩衝顯示在請求開始時被重新設定為 session_cache_limiter 的預設值.這樣,你需要在每次請求時調用 session_cache_limiter() for every request (在 session_start() 調用前).

設定cache限制為'private'
*/

session_cache_limiter('private');
$cache_limiter=session_cache_limiter();
/*設定session的到期時間為30秒*/
session_cache_expire(30);
$cache_expire=session_cache_expire();
/*初始化session*/
session_start();
/*輸出結果內容*/
echo "當前的session cache限制被設定為:$cache_limiter
";
echo "當前的session到期時間為:$cache_expire minutes";
/*
輸出結果為:
the cache limiter is now set to private
the cached session pages expire after 30 minutes


*/

//執行個體二

/*設定caceh限制者為'private'*/
session_cache_limiter('private');
/*返回caceh限制者*/
$cache_limiter=session_cache_limiter();
echo "當前的session cache限制被設定為:$cache_limiter
";


//執行個體三

$filename="test.mpeg";
$filepath="test.mpeg";
session_start();
/*初始化session*/
session_commit();
/*輸出請求的檔案*/
header("content-type: audio/x-mpeg"); //或者其他類型的檔案
header("content-disposition:attachment;filename=".$filename);
header("content-length:".$filesize);
header("content-transfer-encoding:binarynn");
header("pragma:no-cache");
header("expires:0");
$file_contents=file_get_contents($filepath);
print($file_contents

);

http://www.bkjia.com/PHPjc/632344.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632344.htmlTechArticlesession_cache_limiter() 返回當前緩衝限制的名字. 如果指定了 cache_limiter, 當前的緩衝限制的名字被改為新值. 緩衝限制控制著 HTTP 頭髮送到客戶...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.