简单实用的php生成静态页面的方法
虽然方法很多,但使用起来简便容易的,我觉得还是先判断已经生成的首页文件的生成时间和现有时间之间的差值,如果满足某个值就开始生成,这种方法比较来得容易,不多说了,开始吧!
在开始之前还是提一下三个函数吧:"ob_start()、ob_end_clean()、ob_get_contents()"
ob_start():是打开缓冲区的,就是要把您需要生成的静态文件的内容缓存在这里;
ob_get_contents():是读出缓冲区里的内容,下面有代码为例;
ob_end_clean():这个比较重要,只有使用了这个函数后,缓冲区里的内容才会读取出来;
复制内容到剪贴板代码:
以下为引用的内容: if(file_exists("./index.htm"))//看静态index.htm文件是否存在{ $time=time(); //文件修改时间和现在时间相差?的话,直接导向htm文件,否则重新生成htm if($time-filemtime("./index.htm"){ header("Location:classhtml/main.htm"); } } //在你的开始处加入ob_start();CHINAZ //首页内容,就是你的动态部分了 //在结尾加入ob_end_clean(),并把本页输出到一个变量中 //写入文件 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

index.html represents the home page file of the web page and is the default page of the website. When a user visits a website, the index.html page is usually loaded first. HTML (HypertextMarkupLanguage) is a markup language used to create web pages, and index.html is also an HTML file. It contains the structure and content of a web page, as well as tags and elements used for formatting and layout. Here is an example index.html code: <

The goclean command is used to delete compilation intermediate files and target files, free up disk space and keep the project clean. Options include: -f: Force deletion without confirmation -n: List files to be deleted -r: Recursively delete dependent packages -i: Ignore specific dependent packages

GoClean is a utility for cleaning and managing Go projects. It provides the following commands: Check for cleanable items (check) Fix cleanable items (fix) Build the project and clean the build artifacts (build) Check if the project is clean after building (verify) Benefits include: Optimize code Remove unused dependencies Cleanup Build artifacts integrated with multiple tools such as Gofmt

The index in MySQL means index. It is a data structure used to speed up the query of database tables. The index can be compared to the catalog of a book. It stores the values of specific columns in the table and the corresponding row positions, making the database more efficient. Locate and access data quickly. The function of the index is to improve query efficiency. Without an index, the database needs to scan the entire table row by row to find matching data. This method will be very time-consuming in large tables. With an index, the database can The required data rows are quickly located in the order, which greatly improves the query speed.

CAD has many files and caches that we will automatically save during use. Therefore, if we need to uninstall CAD, it is very likely that the uninstallation will not be clean and these files that cannot be used after uninstallation will be retained. At this time, we can find them by method to delete the source file location. How to uninstall cad cleanly in win10 1. First, right-click the start button in the lower left corner of the screen, as shown in the figure. 2. Find the "Applications and Features" at the top 3. Uninstall all Autodesk related software there. 4. After the uninstallation is completed, right-click the start button and open "Run" 5. Enter "regedit" and click "OK" 6. Find the "Autodesk" folder according to the method shown in the figure and delete it. 7. Delete

A deadlock occurred in the background production environment. By checking the deadlock log, we saw that the deadlock was caused by two identical update statements (only the values in the where condition were different), as follows: UPDATEtest_tableSET`status`=1WHERE`trans_id`=' xxx1'AND`status`=0;UPDATEtest_tableSET`status`=1WHERE`trans_id`='xxx2'AND`status`=0; It was confusing at first, but after a lot of querying and learning, the deadlock was analyzed

PHP source code running problem: Index error resolution requires specific code examples. PHP is a widely used server-side scripting language that is often used to develop dynamic websites and web applications. However, sometimes you will encounter various problems when running PHP source code, among which "index error" is a common situation. This article will introduce some common causes and solutions of index errors, and provide specific code examples to help readers better deal with such problems. Problem Description: When running a PHP program

How to remove index.php from https: 1. Modify the server settings, find the .htaccess file on the server and open it, enter "RewriteEngine On...</IfModule>" and other contents in the file, and then save the file; 2 . Use the URL settings of the CMS system, select "Permalink" in the settings, select "Post Name" in the general settings, and then click "Save Changes"; 3. Use a plug-in to help you remove index.php.
