صفحة 1 من 1

[كود] عمل كاش بسيط لاي صفحه

مرسل: 29 مارس 2009, 02:43
بواسطة saanina
هذه طريقة سهله لعمل كاش لاي صفحة

كود: تحديد الكل


<?php
$cacheFile 
'cache/index-cached.html';
$cacheTime 60;
// Serve the cached file if it is older than $cacheTime
if (file_exists($cacheFile) && time() - $cacheTime filemtime($cacheFile)) {
    include(
$cacheFile);
    exit;
}
// Start the output buffer
ob_start();

/* Heres where you put your page content */

// Cache the contents to a file
$cached fopen($cacheFile'w');
fwrite($cachedob_get_contents());
fclose($cached);
ob_end_flush(); // Send the output to the browser
?>


cache/index-cached.html
مسار الصفحة المحفوظه
$cacheTime
وقت حفظ الصفحة

/* Heres where you put your page content */
نضع هنا محتوى صفحتنا

رد: [كود] عمل كاش بسيط لاي صفحه

مرسل: 28 أغسطس 2011, 07:24
بواسطة i.s.s.w
رائع ومفيد جدا

لاتنسى ذكر يفضل تصريح مجلد cache
777 ليعمل بشكل سليم بحفظ الصفحه بالسيرفر

وكود رائع من شخص رائع :)