PHP สอบถามเรื่อง fopen() เป็น include ครับ

เริ่มโดย Golbal, 23 กุมภาพันธ์ 2016, 08:55:22

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

Golbal

<html>
<head>
<title></title>
</head>
<body>
<?php
$strFileName 
"index.html";
$objCreate fopen($strFileName'w');
if(
$objCreate)
{
echo "File Created.";
}
else
{
echo "File Not Create.";
}
fclose($objCreate);
?>

</body>
</html>


จะทำยังไงถ้าต้องการเปลี่ยนจาก fopen เป็น include ครับ
พอดีจะทำ cache ไฟล์แล้วต้องการใส่เวลาด้วย ประมาณว่าถ้าถึงเวลาที่กำหนด
ก็ให้มันเขียนทับหรือไม่ก็ ลบแล้วเขียนไฟล์ใหม่อะครับ :wanwan017:

amazegu

#1
check ไฟล์แคชก่อนว่ามีไฟล์มั๊ย (is_file) ถ้าไม่มีก็ open ถ้ามีก็ include
หาฟังก์ชั่นตรวจสอบเวลาการสร้างไฟล์ (filetime) มาเช็กด้วยว่าอยู่ในเวลาที่กำหนดหรือไม่ครับ

xvlnw.com

[direct=https://cloudhost.in.th/wordpress-hosting]ツ ⓌⓄⓇⒹⓅⓇⒺⓈⓈ ⒽⓄⓈⓉⒾⓃⒼ [/direct] :wanwan014:  :D
[direct=https://cloudhost.in.th/cloudhosting.html]Cloud Hosting[/direct] [direct=https://cloudhost.in.th/cloudvps.html]Cloud Server[/direct] [direct=https://cloudhost.in.th/vpshosting.html]Cloud VPS Hosting[/direct] [direct=https://cloudhost.in.th/windowsvps.html]Cloud Windows[/direct] Tel: 080-348-0843 LINE: ixvlnw

O.o!!

อ้างถึงจาก: amazegu ใน 23 กุมภาพันธ์ 2016, 09:19:53
check ไฟล์แคชก่อนว่ามีไฟล์มั๊ย (is_file) ถ้าไม่มีก็ open ถ้ามีก็ include
หาฟังก์ชั่นตรวจสอบเวลาการสร้างไฟล์ (filetime) มาเช็กด้วยว่าอยู่ในเวลาที่กำหนดหรือไม่ครับ

ตามนี้