根据项目的 index.php 代码,系统会按以下步骤处理请求:
//路由分配
$requestPathArr_ = explode('/', $reqUri);
$template_ = explode("?", $requestPathArr_[1]);
$template = str_replace('.html', '', $template_[0]);
// 判断是否是单页模板(如 /article/list.html)
if((strstr($reqUri, 'http') || count($requestPathArr_) < 3) &&
strstr($requestPathArr_[1], '.html') && ($cityDomainType ==
0 || $isSystemPage)){
$template = checkPagePath($service, $template, $reqUri);
}
当访问 https://{域名}/article/service.html 时:
cd /****/net
# 创建电脑模板目录
mkdir -p templates/service/skin1
# 创建移动端模板目录(如果需要)
mkdir -p templates/service/touch/default
# 将自己所有落地页复制到模板目录
cp /{自建模版}/service/*.html /****/net/templates/service/skin1/
# 如果需要移动端版本
cp /{自建模版}/service/*.html /****/net/templates/service/touch/default/
在 include/config/ 目录下创建 service.inc.php :
<?php
// service模块配置文件
$serviceConfig = array(
"name" => "service",
"title" => "服务落地页",
"description" => "服务落地页模块",
"template" => "skin1", // PC端模板目录
"touchTemplate" => "default", // 移动端模板目录(关键!)
"allowRegister" => 0,
"needLogin" => 0,
"map" => 0,
"map_key" => "",
"map_server_key" => "",
"map_apiFile" => "",
"channelDomain" => "",
"subDomain" => 0,
"visitState" => 0,
"visitMessage" => "",
);
?>
创建 /www/haido/net/api/handlers/service.controller.php :
<?php
/**
* Service Module Controller
* 服务落地页模块控制器
*/
function service($atts = array(), $content = "") {
global $huoniaoTag;
// 获取模块配置
$moduleConfig = getModuleConfig('service');
// 输出模块数据到模板
if(is_array($moduleConfig)){
foreach($moduleConfig as $key => $value){
$huoniaoTag->assign('service_'.$key, $value);
}
}
return "";
}
?>
确保目录结构正确:
/{站点根目录}/
├── api/
│ └── handlers/
│ └── service.controller.php # 新增控制器文件
├── include/
│ └── config/
│ └── service.inc.php # 模块配置文件
└── templates/
└── service/
├── skin1/
│ ├── brand.html # 落地页文件
│ ├── tax.html
│ └── config.xml # 模板配置
└── touch/
└── default/
└── brand.html # 移动端落地页
在 templates/service/skin1/ 目录下创建 config.xml :
<?xml version="1.0" encoding="UTF-8"?>
<root>
<Data>
<name>服务落地页</name>
<version>1.0</version>
<router>0</router>
<author>Haido</author>
</Data>
</root>
登录数据库执行以下SQL:
简版示例SQL
INSERT INTO `#@__site_module` (`name`, `subject`, `type`,
`state`, `sort`, `addtime`)
VALUES ('service', '服务落地页', 0, 0, 99, UNIX_TIMESTAMP());
数据库导出SQL
INSERT INTO `hn_site_module` (`id`, `type`, `parentid`, `title`, `name`, `icon`, `note`, `state`, `weight`, `subnav`, `filelist`, `domainRules`, `catalogRules`, `installsql`, `insertsql`, `delsql`, `version`, `date`, `wx`, `bold`, `target`, `color`, `link`, `subject`, `app`, `bd`, `qm`, `dy`, `pc`, `h5`, `harmony`, `ios`, `android`, `configFile`) VALUES (NULL, '0', '1', '服务', 'service', '0', '6', '', '', NULL, NULL, NULL, NULL, '', 'v1.0.0', '1730517922', '1', '0', '0', '', '', '服务', '0', '0', '0', '0', '1', '1', '1', '1', '1', NULL)
修改完成后,清除缓存:
rm -rf /{自建站点}/cache/*
完成以上检查,再次 https://{域名}/service/brand.html 可正常访问!