Sharing development examples of how php generates shtml

黄舟
Release: 2023-03-15 11:22:02
Original
2174 people have browsed it

Mainly introduces the usage of php to generate shtml class. It describes in more detail the class file that generates shtml and the corresponding usage examples. It has certain reference value. Friends in need can refer to it, or you can make it according to your own needs. require various modifications.

The first step is to download the php generated shtml class library we need to use for this course: http://www.php.cn/xiazai/leiku/491

Second Step. After the download is completed, find the php class file we need, unzip it to our local directory, and create a new php file!

The third step, after completion, we need to call this class in the new php file and instantiate the class:

<?php

include_once "shtml.php";//引入类文件

//定义文件内容
$arr = array();
$arr["title"] = "php中文网";
$arr["content"] = "www.php.cn";

$obj = new Shtml;        //实例化
$obj->FileName="xxx.htm"; //生成文件的名字
$obj->Templet="网站名称:<FIELD_title> 网站地址:<FIELD_content>"; //生成文件内容
$obj->BindData($arr);
//一切OK,万事达吉
$obj->Create();
?>
Copy after login

Run the file, and the result will be as shown below:

Sharing development examples of how php generates shtml

Note:

1. Although we execute the file, what page None, but the file has been created locally

2. As shown in the figure below, we have created the file :

Sharing development examples of how php generates shtml


#

The above is the detailed content of Sharing development examples of how php generates shtml. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template