PHP语言写前端页面必须的结构

组成结构:

模板文件放在templets文件夹里。
images 文件夹用于存放网站所需的css、js文件以及图片文件。
article.tpl 这个是文章页面的模板文件。
articlecategory.tpl 这个是文章列表页面的模板文件。
category.tpl 这个是分类页面的模板文件这个一般不用修改,直接复制过来就行。
comment.tpl 这个是留言页面的模板。
config.xml 这个文件用于在网站后台模板列表里显示的模板名。
footer.tpl 是网站的底部文件。
header.tpl 是头部文件这俩文件。
index.tpl 首页的模板文件。
preview.gif 后面模板列表显示的模板缩略图。
product.tpl 产品页面的模板文件。
productcategory.tpl 产品分类页面的模板文件。
side.tpl 侧边栏的模板文件,也用做公共调用文件。

伪静态:

1.apache
如果服务器软件为apache,直接进入后台开启URL重写,提交以后,就可以了.
如果不能正常生成.htaccess到根目录,请将.htaccess上传至根目录.

配置步骤:
第一步:找到apache的配置文件httpd.conf(文件在conf目录下)
第二步:
打开httpd.conf,找到#LoadModule rewrite_module modules/mod_rewrite.so
把#去掉
找到AllowOverride None 改成 AllowOverride All

2.iis
如果服务器软件为iis,请确保服务端安装过ISAPI_Rewrite组件.
规则
RewriteRule ^/article/(.+).html$ /article.php?name=KaTeX parse error: Can't use function '\.' in math mode at position 29: … ^/product/(.+)\̲.̲html /product.php?name= 1 R e w r i t e R u l e / c a t e g o r y / ( [ ] / + ) [ / ] ? 1 RewriteRule ^/category/([^/_]+)[/]? /category.php?name= 1 R e w r i t e R u l e / c a t e g o r y / ( [ / ] + ) ( [ 0 9 ] + ) [ / ] ? 1 RewriteRule ^/category/([^/]+)_([0-9]+)[/]? /category.php?name=$1&p= 2 R e w r i t e R u l e / c a t a l o g / ( [ / ] + ) [ / ] ? 2 RewriteRule ^/catalog/([^/]+)[/]? /catalog.php?type=KaTeX parse error: Can't use function '\.' in math mode at position 24: …eRule ^/comment\̲.̲html /comment.php
RewriteRule ^/sitemap.xml$ /sitemap.php

配置步骤:
第一步:找到Internet信息服务器.
第二步:右击站点,‘属性’,‘ISAPI筛选器’,‘添加’,'筛选器名称’输入:rewrite ,'浏览’选择文件:

Re
write.dll,打开,确定.
第二步:右击站点,停止’,然后’启动’.

3.nginx
如果服务器软件为nginx,请联系主机提供商,加入以下规则
rewrite ^/article/(.+).html$ /article.php?name=$1 last;
rewrite ^/product/(.+).html /product.php?name=$1 last;
rewrite /category/([/]+)([0-9]+)[/]? /category.php?name=$1&p=$2 last;
rewrite /category/([/
]+)[/]? /category.php?name=$1 last;
rewrite /catalog/([/]+)[/]? /catalog.php?type= 1 l a s t ; r e w r i t e / c o m m e n t . h t m l 1 last; rewrite ^/comment.html /comment.php last;
rewrite ^/sitemap.xml$ /sitemap.php last;

猜你喜欢

转载自blog.csdn.net/weixin_43932097/article/details/100007816
今日推荐