域名后面加个点为什么加ptcms

&nbsp>&nbsp
&nbsp>&nbsp
&nbsp>&nbsp
建站DIV+CSS 之网页切图过程中div+css命名规则
摘要:欢迎访问:www.ptcms.cn内容:content/container&&导航:nav&&&侧栏:sidebar&&栏目:column&&标志:logo&&页面主体:main&&&&广告:banner&&&热点:hot&&&新闻:news&&&n
欢迎访问: www.ptcms.cn内容:content/container&& 导航:nav&&& 侧栏:sidebar &&栏目:column&& 标志:logo&& 页面主体:main &&&&广告:banner&&& 热点:hot&&& 新闻:news&&&&&&&&&&&&&&下载:download&&& 子导航:subnav&&& 菜单:menu搜索:search&& 页脚:footer&&& 滚动:scroll&&&&& 版权:copyright&& 友情链接:friendlink&&& 子菜单:submenu&&&&&内容:content&&& 标签页:tab&& 文章列表:list&&&&&&&&&&&注册:regsiter&& 提示信息:msg&& 小技巧:tips&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&加入:joinus&& 栏目标题:title&& 指南:guild&&&&&&&&&&&&&&&&&& 服务:service&& 状态:status&&& 投票:vote&&&&&&&&&&&&&&&&&&&&& &尾:footer&& 合作伙伴:partner&& 登录条:loginbar页面外围控制整体布局宽度:wrapper&& 左右中:left right center &&&&&&&&&&&&(二)注释的写法: /* Footer */ 内容区 /* End Footer */&&(三)id的命名: (1)页面结构 容器: container&&&&&&&&&&&页头:header&&&&&&&&&&&&&&&&& 内容:content/container&&&&&&&&&&&&页面主体:main&&&&&&&&& 页尾:footer&&&&&&&&&&&&& &&&&& 导航:nav&&&&&&&&&&&&&&&&&& 侧栏:sidebar&&&&&&&&&&&&&栏目:column&&&&&&&&&&&&& 左右中:left right center 页面外围控制整体布局宽度:wrapper&&&&
(2)导航 导航:nav 主导航:mainbav 子导航:subnav 顶导航:topnav 边导航:sidebar 左导航:leftsidebar 右导航:rightsidebar 菜单:menu&&&&&&&&&子菜单:submenu&&&&&&&&&标题: title&&&&&&&摘要: summary (3)功能 标志:logo 广告:banner 登陆:login 登录条:loginbar 注册:regsiter 搜索:search 功能区:shop 标题:title 加入:joinus 状态:status 按钮:btn 滚动:scroll 标签页:tab 文章列表:list 提示信息:msg 当前的: current 小技巧:tips 图标: icon 注释:note 指南:guild 服务:service 热点:hot 新闻:news 下载:download 投票:vote 合作伙伴:partner 友情链接:link 版权:copyright (四)class的命名: (1)颜色:使用颜色的名称或者16进制代码,如 .red { color: } .f60 { color: #f60; } .ff8600 { color: #ff8600; } (2)字体大小,直接使用&font+字体大小&作为名称,如 .font12px { font-size: 12 } .font9pt {font-size: 9 } (3)对齐样式,使用对齐目标的英文名称,如 .left { float: } .bottom { float: } (4)标题栏样式,使用&类别+功能&的方式命名,如 .barnews { } .barproduct { } 注意事项: 1.一律小写; 2.尽量用英文; 3.不加中杠和下划线; 4.尽量不缩写,除非一看就明白的单词. 主要的 master.css&&&&&&&&&&&& 模块 module.css&&&&&&&&&&&&基本共用 base.css&&&&&&&&&&主题 themes.css&&&&&&&&&&&&&& 专栏 columns.css&&&&&&&&&&&&&&&&& 打印 print.css&&&文字 font.css&&&&&&&&&&&&&&&&&&&& 表单 forms.css&&&&&&&&&&&&&&&&&&&&& 补丁 mend.css&&&&&&&&&&&&&&&&&&布局,版面 layout.css
以上是的内容,更多
的内容,请您使用右上方搜索功能获取相关信息。
若你要投稿、删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内给你回复。
云服务器 ECS
可弹性伸缩、安全稳定、简单易用
&40.8元/月起
预测未发生的攻击
&24元/月起
为您提供0门槛上云实践机会
你可能还喜欢
你可能感兴趣
阿里云教程中心为您免费提供
建站DIV+CSS 之网页切图过程中div+css命名规则相关信息,包括
的信息,所有建站DIV+CSS 之网页切图过程中div+css命名规则相关内容均不代表阿里云的意见!投稿删除文章请联系邮箱:zixun-group@service.aliyun.com,工作人员会在五个工作日内答复
售前咨询热线
支持与服务
资源和社区
关注阿里云
International子域名查询
百度收录百度权重PR2级子域名3级子域名3级以下子域名
您输入的主域名:loanfx.net
在<loanfx.net>下有以下子域名:
没找到任何子域名!
最近查询:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
输入任意域名,查看该顶级域名下所有相关的子域名,包括二级域名、三级域名等.
同时可以查询这些域名的百度收录和PR值。
站长工具导航地图
网站信息查询:
&SEO信息查询:
百度相关工具:
&域名/IP查询:
代码转换工具:
其他工具:application
controller
index_add.html
index_edit.html
index_index.html
index_show.html
controller
glyphicons-halflings-regular.eot
glyphicons-halflings-regular.svg
glyphicons-halflings-regular.ttf
glyphicons-halflings-regular.woff
bg-button-green.gif
container_bg.gif
left_bg.gif
line_x.gif
loading.gif
login_bg.png
login_logo.png
login_t.png
message_bg.gif
nav_bg.png
order_bg.gif
range-line.gif
sidebar_title_bg.gif
skin_list_bg.gif
skin_list_urrent.gif
skin_tab_bg.gif
td_title_bg.gif
win_bg.png
content_replace.html
index_index.html
index_welcome.html
public_layout.html
public_login.html
theme_config.html
theme_index.html
controller
autoupdate
install.sql
uninstall.sql
index.html
friendlink
controller
index_add.html
index_edit.html
index_index.html
controller
controller
global.css
index.html
layout.html
novel.html
success.html
controller
adminuser_index.html
api_index.html
base_index.html
link_index.html
tkd_index.html
controller
clear_cache.html
clear_reset.html
id_conv.html
rewrite_rule.html
controller
pinyin.dat
loading.gif
loading2.gif
success.gif
datepicker
datepicker.css
datepicker.css
dateselect.gif
glass-bg.gif
hd-sprite.gif
left-btn.gif
left-btn2.gif
readme.txt
right-btn.gif
right-btn2.gif
datePicker.gif
WdatePicker.css
textbg.png
xubox_ico0.png
xubox_loading0.gif
xubox_loading1.gif
xubox_loading2.gif
xubox_loading3.gif
xubox_title0.png
layer.ext.css
loading.gif
validator_default.png
validator_simple.png
jquery.validator.css
footer.html
header.html
message.html
category.html
chapter.html
index.html
novel.html
search.html
avatars_bg.gif
btnlink.gif
btnlinks.gif
button.gif
downDig2.png
form_close.jpg
li_bottom.jpg
p1_6_1.jpg
p3_2_1.jpg
search_btn.jpg
search_txt.jpg
search_type.jpg
smileb.gif
textareabg.png
top_bg.jpg
uicons.gif
login.html
register.html
config.ini
favicon.ico
robots.txt
更新记录.txt
* @Author: 杰少Pakey
* @Email :
: PTCMS.php
// 设置基本参数
//设置时区(中国)
date_default_timezone_set(&PRC&);
// 记录开始运行时??
$GLOBALS[&#39;_startTime&#39;] = microtime(TRUE);
// 记录sql执行次数
$GLOBALS[&#39;_sql&#39;] = array();
// 缓存读取次数
$GLOBALS[&#39;_cacheRead&#39;] = 0;
// 缓存写入次数
$GLOBALS[&#39;_cacheWrite&#39;] = 0;
// 记录内存初始使用
$GLOBALS[&#39;_startUseMems&#39;] = memory_get_usage();
// 记录网络请求
$GLOBALS[&#39;_api&#39;] = array();
// 框架版本??
define(&#39;PTCMS_VERSION&#39;, &#39;3.1.3 ;);
// debug信息 是否开启当前项目debug模式 默认 不开??
defined(&#39;APP_DEBUG&#39;) || define(&#39;APP_DEBUG&#39;, false);
if (PHP_SAPI == &#39;cli&#39;) {
$_root = &#39;/&#39;;
$_root = str_replace(&#39;\\&#39;, &#39;/&#39;, dirname(rtrim(str_replace(&#39;\\&#39;, &#39;/&#39;, $_SERVER[&#39;SCRIPT_NAME&#39;]), &#39;/&#39;)));
//网站内部地址 子目录地址
defined(&#39;PT_DIR&#39;) || define(&#39;PT_DIR&#39;, rtrim($_root, &#39;/&#39;));
if ($pos = strpos($_SERVER[&#39;HTTP_HOST&#39;], &#39;:&#39;)) {
$host = substr($_SERVER[&#39;HTTP_HOST&#39;], 0, $pos);
$host = $_SERVER[&#39;HTTP_HOST&#39;];
// 网站访问域名 不包括入口文件及参数
defined(&#39;PT_URL&#39;) || define(&#39;PT_URL&#39;, &#39;http://&#39; . $host . (($_SERVER[&#39;SERVER_PORT&#39;] == 80) ? &#39;&#39; : &#39;:&#39; . $_SERVER[&#39;SERVER_PORT&#39;]) . PT_DIR);
//项目根目??
defined(&#39;PT_ROOT&#39;) || define(&#39;PT_ROOT&#39;, str_replace(&#39;\\&#39;, &#39;/&#39;, dirname($_SERVER[&#39;SCRIPT_FILENAME&#39;])));
//PTCMS根目??
defined(&#39;PT_PATH&#39;) || define(&#39;PT_PATH&#39;, dirname(__FILE__));
// 项目目录
defined(&#39;APP_PATH&#39;) || define(&#39;APP_PATH&#39;, PT_ROOT . &#39;/application&#39;);
//缓存目录
defined(&#39;CACHE_PATH&#39;) || define(&#39;CACHE_PATH&#39;, PT_ROOT . &#39;/runtime&#39;);
//数据目录/
defined(&#39;DATA_PATH&#39;) || define(&#39;DATA_PATH&#39;, APP_PATH . &#39;/common/data&#39;);
//模版目录
defined(&#39;TPL_PATH&#39;) || define(&#39;TPL_PATH&#39;, PT_ROOT . &#39;/template&#39;);
// 环境常量
define(&#39;NOW_TIME&#39;, $_SERVER[&#39;REQUEST_TIME&#39;]);
define(&#39;IS_GET&#39;, $_SERVER[&#39;REQUEST_METHOD&#39;] === &#39;GET&#39; ? true : false);
define(&#39;IS_POST&#39;, $_SERVER[&#39;REQUEST_METHOD&#39;] === &#39;POST&#39; ? true : false);
define(&#39;IS_AJAX&#39;, ((isset($_SERVER[&#39;HTTP_X_REQUESTED_WITH&#39;]) && strtolower($_SERVER[&#39;HTTP_X_REQUESTED_WITH&#39;]) == &#39;xmlhttprequest&#39;) || !empty($_POST[&#39;isajax&#39;]) || !empty($_GET[&#39;isajax&#39;])) ? true : false);
// 判断是否有html缓存
if (IS_GET && strpos($_SERVER[&#39;REQUEST_URI&#39;], &#39;.php&#39;) === false && is_file(PT_ROOT . $_SERVER[&#39;REQUEST_URI&#39;])) {
pt::show();
readfile(PT_ROOT . $_SERVER[&#39;REQUEST_URI&#39;]);
// 自动识别SAE环境
if (function_exists(&#39;saeAutoLoader&#39;) or function_exists(&#39;sae_auto_load&#39;)) {
defined(&#39;APP_MODE&#39;) or define(&#39;APP_MODE&#39;, &#39;sae&#39;);
// 普通模??
defined(&#39;APP_MODE&#39;) or define(&#39;APP_MODE&#39;, &#39;common&#39;);
//后台运行程序
if (!empty($_GET[&#39;backRun&#39;])) {
//生成html
if (function_exists(&#39;fastcgi_finish_request&#39;)) {
fastcgi_finish_request();
echo str_repeat(&#39; &#39;,4096);
ob_flush();
// 加载公共配置文件
C(pt::import(APP_PATH . &#39;/common/config.php&#39;));
// 编译模式
if (APP_DEBUG) {
// 开启错误输??
ini_set(&#39;display_errors&#39;, &#39;on&#39;);
// 设置错误输出级别
error_reporting(E_ALL);
pt::import(APP_PATH . &#39;/common/function.php&#39;);
$GLOBALS[&#39;_automap&#39;] = get_auto_map();
// 开启错误输??
ini_set(&#39;display_errors&#39;, &#39;off&#39;);
// 设置错误输出级别
error_reporting(0);
// 合并核心文件
$runtimefile = CACHE_PATH . &#39;/pt_runtime.php&#39;;
if (!is_file($runtimefile)) {
$files = array(
PT_PATH . &#39;/core/cache.php&#39;,
PT_PATH . &#39;/driver/cache/&#39; . strtolower(C(&#39;CACHE_DRIVER&#39;, null, &#39;memcache&#39;)) . &#39;.php&#39;,
PT_PATH . &#39;/core/controller.php&#39;,
PT_PATH . &#39;/core/dispatcher.php&#39;,
PT_PATH . &#39;/core/log.php&#39;,
PT_PATH . &#39;/core/plugin.php&#39;,
PT_PATH . &#39;/core/storage.php&#39;,
PT_PATH . &#39;/driver/storage/&#39; . strtolower(C(&#39;STORAGE_DRIVER&#39;, null, &#39;file&#39;)) . &#39;.php&#39;,
PT_PATH . &#39;/core/view.php&#39;,
PT_PATH . &#39;/core/block.php&#39;,
APP_PATH . &#39;/common/function.php&#39;
if (C(&#39;db_mysql&#39;)) {
$file[] = PT_PATH . &#39;/core/model.php&#39;;
$file[] = PT_PATH . &#39;/driver/model/&#39; . strtolower(C(&#39;db_mysql.driver&#39;)) . &#39;.php&#39;;
$str = &&?php &;
$str .= &\$GLOBALS[&#39;_automap&#39;]=& . var_export(get_auto_map(), true) . &#39;;&#39;;
foreach ($files as $file) {
$str .= trim(substr(php_strip_whitespace($file), 5));
F($runtimefile, $str);
pt::start();
class pt {
* 框架开始调??
public static function start() {
//初始化加??
self::init();
plugin::call(&#39;app_init_start&#39;);
//加载站点配置文件
C(self::import(APP_PATH . &#39;/common/&#39; . pt::getSiteCode() . &#39;.config.php&#39;));
// 路由解析
plugin::call(&#39;dispatcher_start&#39;);
self::dispatcher();
plugin::call(&#39;dispatcher_end&#39;);
if (MODULE_NAME != &#39;common&#39;) {
// 加载模块文件
C(self::import(APP_PATH . &#39;/&#39; . MODULE_NAME . &#39;/config.php&#39;));
// 加载函数
self::import(APP_PATH . &#39;/&#39; . MODULE_NAME . &#39;/function.php&#39;);
// 控制器调??
self::app();
* 注册autoload等操??
protected static function init() {
// 设定错误和异常处??
register_shutdown_function(array(__CLASS__, &#39;shutdown&#39;));
//set_error_handler(array(__CLASS__, &#39;error&#39;));
set_exception_handler(array(__CLASS__, &#39;exception&#39;));
// 注册AUTOLOAD方法
spl_autoload_register(array(__CLASS__, &#39;autoload&#39;));
// 取消对GPC的自动处??
if (version_compare(PHP_VERSION, &#39;5.4.0&#39;, &#39;&&#39;)) {
ini_set(&#39;magic_quotes_runtime&#39;, 0);
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map(&#39;stripslashes_deep&#39;, $value) : (isset($value) ? stripslashes($value) : null);
$_POST = stripslashes_deep($_POST);
$_GET = stripslashes_deep($_GET);
$_COOKIE = stripslashes_deep($_COOKIE);
// 注册插件
Plugin::register(C(&#39;plugin&#39;, null, array()));
protected static function app() {
//加载控制器启动的插件
plugin::call(&#39;controller_start&#39;);
//正常模式
$controllerFile = APP_PATH . &#39;/&#39; . MODULE_NAME . &#39;/controller/&#39; . CONTROLLER_NAME . &#39;.php&#39;;
$classname = CONTROLLER_NAME . &#39;Controller&#39;;
$actionname = ACTION_NAME . &#39;Action&#39;;
if (MODULE_NAME == &#39;plugin&#39;) {
//插件控制??
$controllerFile = APP_PATH . &#39;/common/plugin/&#39; . CONTROLLER_NAME . &#39;/manage.php&#39;;
$classname = &#39;manageController&#39;;
$actionname = ACTION_NAME . &#39;Action&#39;;
} elseif (!in_array(MODULE_NAME, explode(&#39;,&#39;, C(&#39;allow_module&#39;, null, &#39;&#39;)))) {
$app = new Controller();
$app-&_empty(MODULE_NAME . &#39;模块不允许访??);
if (is_file($controllerFile)) {
include $controllerF
if (class_exists($classname, false)) {
$app = new $classname();
//加载init方法
if (method_exists($app, &#39;init&#39;)) {
$app-&init();
// 加载action
if (method_exists($app, $actionname)) {
$app-&$actionname();
$app-&_empty(&当前控制器下& . get_class($app) . &找不到指定的方法 {$_GET[&#39;a&#39;]}Action&);
plugin::call(&#39;controller_end&#39;);
$app = new Controller();
$app-&_empty(&#39;控制?? . CONTROLLER_NAME . &#39;对应的文件中未找到类&#39; . $classname);
$app = new Controller();
$app-&_empty(MODULE_NAME . &#39;模块下控制器&#39; . CONTROLLER_NAME . &#39;Controller对应的文件不存在&#39;);
public static function import($filename) {
static $_importFiles = array();
if (!isset($_importFiles[$filename])) {
if (is_file($filename)) {
$_importFiles[$filename] = include $
$_importFiles[$filename] =
return $_importFiles[$filename];
protected static function dispatcher() {
dispatcher::run();
// 获取分组 模块和操作名??
define(&#39;MODULE_NAME&#39;, strtolower($_GET[&#39;m&#39;]));
define(&#39;CONTROLLER_NAME&#39;, strtolower($_GET[&#39;c&#39;]));
define(&#39;ACTION_NAME&#39;, strtolower($_GET[&#39;a&#39;]));
define(&#39;__SELF__&#39;, strip_tags($_SERVER[&#39;REQUEST_URI&#39;]));
define(&#39;__APP__&#39;, rtrim($_SERVER[&#39;SCRIPT_NAME&#39;], &#39;/&#39;));
// 当前模块和分组地址
define(&#39;__MODULE__&#39;, __APP__ . &#39;?s=&#39; . strtolower(empty($_GET[&#39;_m&#39;]) ? $_GET[&#39;m&#39;] : $_GET[&#39;_m&#39;]));
define(&#39;__URL__&#39;, __MODULE__ . &#39;/&#39; . CONTROLLER_NAME);
// 当前操作地址
define(&#39;__ACTION__&#39;, __URL__ . &#39;/&#39; . ACTION_NAME);
// 自动加载
public static function autoload($class) {
$classfile = strtolower(str_replace(&#39;_&#39;, &#39;/&#39;, $class));
if (in_array($classfile, array(&#39;controller&#39;, &#39;view&#39;, &#39;dispatcher&#39;, &#39;cache&#39;, &#39;model&#39;, &#39;plugin&#39;, &#39;storage&#39;, &#39;block&#39;, &#39;log&#39;))) {
pt::import(PT_PATH . &#39;/core/&#39; . $classfile . &#39;.php&#39;);
} elseif (substr($classfile, 0, 6) == &#39;driver&#39;) {
pt::import(PT_PATH . &#39;/&#39; . $classfile . &#39;.php&#39;);
} elseif (substr($classfile, -10) == &#39;controller&#39;) {
if (!pt::import(APP_PATH . &#39;/&#39; . MODULE_NAME . &#39;/controller/&#39; . substr($classfile, 0, -10) . &#39;.php&#39;)) {
pt::import(APP_PATH . &#39;/common/controller/&#39; . substr($classfile, 0, -10) . &#39;.php&#39;);
} elseif (substr($classfile, -5) == &#39;model&#39;) {
//适配ptcms_a_b这样的表
$classfile = substr(str_replace(&#39;/&#39;, &#39;_&#39;, $classfile), 0, -5);
// todo 插件下的
if (isset($GLOBALS[&#39;_automap&#39;][&#39;model&#39;][$classfile])) {
//存在这个model
if (isset($GLOBALS[&#39;_automap&#39;][&#39;model&#39;][$classfile][MODULE_NAME])) {
$file = $GLOBALS[&#39;_automap&#39;][&#39;model&#39;][$classfile][MODULE_NAME];
} elseif (isset($GLOBALS[&#39;_automap&#39;][&#39;model&#39;][$classfile][&#39;common&#39;])) {
$file = $GLOBALS[&#39;_automap&#39;][&#39;model&#39;][$classfile][&#39;common&#39;];
$file = current(array_slice($GLOBALS[&#39;_automap&#39;][&#39;model&#39;][$classfile], 0, 1));
pt::import($file);
} elseif (substr($classfile, -5) == &#39;block&#39;) {
$classfile = substr($classfile, 0, -5);
if (isset($GLOBALS[&#39;_automap&#39;][&#39;block&#39;][$classfile])) {
//存在这个block
if (isset($GLOBALS[&#39;_automap&#39;][&#39;block&#39;][$classfile][MODULE_NAME])) {
$file = $GLOBALS[&#39;_automap&#39;][&#39;block&#39;][$classfile][MODULE_NAME];
} elseif (isset($GLOBALS[&#39;_automap&#39;][&#39;block&#39;][$classfile][&#39;common&#39;])) {
$file = $GLOBALS[&#39;_automap&#39;][&#39;block&#39;][$classfile][&#39;common&#39;];
$file = current(array_slice($GLOBALS[&#39;_automap&#39;][&#39;block&#39;][$classfile], 0, 1));
pt::import($file);
} elseif (substr($classfile, -6) == &#39;plugin&#39;) {
$classname = substr($classfile, 0, -6);
pt::import(APP_PATH . &#39;/common/plugin/&#39; . $classname . &#39;/&#39; . $classname . &#39;.php&#39;);
if (!pt::import(PT_PATH . &#39;/library/&#39; . $classfile . &#39;.php&#39;) && isset($GLOBALS[&#39;_automap&#39;][&#39;library&#39;][$classfile])) {
if (isset($GLOBALS[&#39;_automap&#39;][&#39;library&#39;][$classfile][MODULE_NAME])) {
$file = $GLOBALS[&#39;_automap&#39;][&#39;library&#39;][$classfile][MODULE_NAME];
} elseif (isset($GLOBALS[&#39;_automap&#39;][&#39;library&#39;][$classfile][&#39;common&#39;])) {
$file = $GLOBALS[&#39;_automap&#39;][&#39;library&#39;][$classfile][&#39;common&#39;];
$file = current(array_slice($GLOBALS[&#39;_automap&#39;][&#39;library&#39;][$classfile], 0, 1));
pt::import($file);
// 中止操作
public static function shutdown() {
// 判断是否有错??
if ($e = error_get_last()) {
if (in_array($e[&#39;type&#39;], array(1, 4))) {
halt($e[&#39;message&#39;], $e[&#39;file&#39;], $e[&#39;line&#39;]);
//如果开启日??则记录日??
if (C(&#39;log&#39;, null, false)) log::build();
// 如果自定义了close函数 则进行调??
if (function_exists(&#39;pt_close&#39;)) {
pt_close();
// 异常处理
public static function exception(Exception $e) {
halt($e-&getmessage(), $e-&getFile(), $e-&getLine());
// 错误处理
public static function error($errno, $errstr, $errfile, $errline) {
switch ($errno) {
case E_ERROR:
case E_PARSE:
case E_CORE_ERROR:
case E_COMPILE_ERROR:
halt($errstr, $errfile, $errline);
case E_USER_ERROR:
case E_STRICT:
case E_USER_WARNING:
case E_USER_NOTICE:
public static function err404($msg = &#39;找不到指定的页面&#39;) {
$file = PT_ROOT . C(&#39;404file&#39;, null, &#39;/404.html&#39;);
log::write($msg);
if (is_file($file)) {
$content = F($file);
$content = str_replace(array(&#39;{$sitename}&#39;, &#39;{$siteurl}&#39;, &#39;{$msg}&#39;), array(C(&#39;sitename&#39;), C(&#39;siteurl&#39;), $msg), $content);
exit($content);
exit($msg . &#39; 页面出现错误,如需自定义此错误,请创建文件?? . $file);
* 获取host
public static function getSiteCode() {
// 替换域名中的-为_
$domain = str_replace(&#39;-&#39;, &#39;_&#39;, $_SERVER[&#39;HTTP_HOST&#39;]);
// 去掉端口
if (strpos($domain, &#39;:&#39;) !== false) $domain = substr($domain, 0, strpos($domain, &#39;:&#39;));
// 去掉开始的www.
if (stripos($domain, &#39;www.&#39;) === 0) $domain = substr($domain, 4);
* 输出视图内容
* @access public
* @param string $content
* @param string $mimeType MIME类型
* @return void
public static function show($content = &#39;&#39;, $mimeType = &#39;text/html&#39;) {
if (C(&#39;gzip_encode&#39;, null, false)) {
$zlib = ini_get(&#39;zlib.output_compression&#39;);
if (empty($zlib)) ob_start(&#39;ob_gzhandler&#39;);
if (!headers_sent()) {
//设置系统的输出字符为utf-8
header(&Content-Type: $mimeT charset=utf-8&);
//支持页面回跳
header(&Cache-control: private&);
header(&Connection:Keep-Alive&);
//版权标识
header(&X-Powered-By: PTcms Studio (www.ptcms.com)&);
* 获取和设置配置参??支持批量定义
* @param string|array $name 配置变量
* @param mixed $value
* @param mixed $default
* @return mixed
function C($name = null, $value = null, $default = null) {
static $_config = array();
// 无参数时获取所??
if (empty($name)) {
// 优先执行设置获取或赋??
if (is_string($name)) {
$name = strtolower($name);
if (!strpos($name, &#39;.&#39;)) {
if (is_null($value))
return $_config[$name] = isset($_config[$name]) ? $_config[$name] : $
$_config[$name] = $
// 二维数组设置和获取支??
$name = explode(&#39;.&#39;, $name);
if (is_null($value)) {
$value = $_
foreach ($name as $n) {
if (isset($value[$n])) {
$value = $value[$n];
$value = $
$_config[$name[0]][$name[1]] = $
// 批量设置
if (is_array($name)) {
$_config = array_merge($_config, array_change_key_case($name));
// 避免非法参数
* Cookie 设置、获取、删??
* @param string $name
cookies名称
* @param string $value
* @param string $option cookie参数
* @return mixed
function cookie($name, $value = &#39;&#39;, $option = null) {
static $_config =
if (!$_config) {
// 默认设置
$_config = array(
// cookie 名称前缀
&#39;prefix&#39; =& C(&#39;cookie_prefix&#39;, null, &#39;PTCMS_&#39;),
// cookie 保存时间
&#39;expire&#39; =& intval(C(&#39;cookie_expire&#39;, null, 2592000)),
// cookie 保存路径
&#39;path&#39; =& C(&#39;cookie_path&#39;, null, &#39;/&#39;),
// cookie 有效域名
&#39;domain&#39; =& C(&#39;cookie_domain&#39;),
// 参数设置(会覆盖黙认设??
if (!is_null($option)) {
if (is_numeric($option))
$option = array(&#39;expire&#39; =& $option);
elseif (is_string($option))
parse_str($option, $option);
$config = array_merge($_config, array_change_key_case($option));
$config = $_
// 清除指定前缀的所有cookie
if (is_null($name)) {
if (empty($_COOKIE))
// 要删除的cookie前缀,不指定则删除config设置的指定前缀
$prefix = empty($value) ? $config[&#39;prefix&#39;] : $
if (!empty($prefix)) {
// 如果前缀为空字符串将不作处理直接返回
foreach ($_COOKIE as $key =& $val) {
if (0 === stripos($key, $prefix)) {
setcookie($key, &#39;&#39;, time() - 3600, $config[&#39;path&#39;], $config[&#39;domain&#39;]);
unset($_COOKIE[$key]);
$name = $config[&#39;prefix&#39;] . $
if (&#39;&#39; === $value) {
if (isset($_COOKIE[$name])) {
return $_COOKIE[$name];
if (is_null($value)) {
setcookie($name, &#39;&#39;, time() - 3600, $config[&#39;path&#39;], $config[&#39;domain&#39;]);
// 删除指定cookie
unset($_COOKIE[$name]);
// 设置cookie
$expire = !empty($config[&#39;expire&#39;]) ? time() + $config[&#39;expire&#39;] : 0;
setcookie($name, $value, $expire, $config[&#39;path&#39;], $config[&#39;domain&#39;]);
$_COOKIE[$name] = $
* 文件函数
* @param string $file
需要写入的文件,系统的绝对路径加文件名
* @param bool $content 不填??读取 null 删除 其他 写入
* @param string $mod
写入模式??
* @return mixed
function F($file, $content = false, $mod = &#39;&#39;) {
if ($content === false) {
return is_file($file) ? file_get_contents($file) :
} elseif ($content === null) {
if (is_file($file)) {
//删除文件
return unlink($file);
} elseif (is_dir($file)) {
//删除目录
$handle = opendir($file);
while (($filename = readdir($handle)) !== false) {
if ($filename !== &#39;.&#39; && $filename !== &#39;..&#39;) F($file . &#39;/&#39; . $filename, null);
closedir($handle);
return @rmdir($file);
if (!strpos($file, &#39;://&#39;) && !is_dir(dirname($file))) {
mkdir(dirname($file), 0755, true);
if (is_array($content)) {
if (APP_DEBUG) {
$content = str_replace(&#39;\\\\&#39;, &#39;\\&#39;, &#39;&?php&#39; . PHP_EOL . &#39;return &#39; . var_export($content, true) . &#39;;&#39;);
$content = str_replace(&#39;\\\\&#39;, &#39;\\&#39;, strip_whitespace(&#39;&?php&#39; . PHP_EOL . &#39;return &#39; . var_export($content, true) . &#39;;&#39;));
if ($mod) {
return file_put_contents($file, strval($content), LOCK_EX | $mod);
return file_put_contents($file, strval($content), LOCK_EX);
* M函数用于实例化Model
* @param string $name
* @param string $layer Model分层
* @return object
function M($name = &#39;&#39;, $layer = &#39;&#39;) {
static $_model = array();
if ($layer === &#39;&#39;) {
$layer = strtolower(C(&#39;default_model_layer&#39;, null, &#39;model&#39;));
if (empty($_model[$name])) {
if ($name) {
$name = strtolower($name);
$classname = &{$name}{$layer}&;
//采用自动加载加载??不存在则加载默认??
if (MODULE_NAME == &#39;plugin&#39;) {
$file = APP_PATH . &#39;/common/plugin/&#39; . MODULE_NAME . &#39;/&#39; . $layer . &#39;/&#39; . $name . &#39;.php&#39;;
$file = APP_PATH . &#39;/&#39; . MODULE_NAME . &#39;/model/&#39; . $layer . &#39;.php&#39;;
if (!pt::import($file)) {
pt::import(APP_PATH . &#39;/common/model/&#39; . $layer . &#39;.php&#39;);
if (!class_exists($classname)) $classname = $
$classname = $
$_model[$name] = new $classname($name);
return $_model[$name];
function halt($msg, $file = &#39;&#39;, $line = &#39;&#39;) {
if (APP_DEBUG) {
pt::show();
$e[&#39;message&#39;] = $
$e[&#39;file&#39;] = $
$e[&#39;line&#39;] = $
include PT_PATH . &#39;/error.tpl&#39;;
PT::err404($msg);
* 获取输入参数 支持过滤和默认??
* @param string $name
变量的名??支持指定类型
* @param mixed $default 不存在的时候默认??
* @param mixed $filter
参数过滤方法
* @param array $input
* @return mixed
function I($name, $filter = &#39;int&#39;, $default = null, $input = array()) {
// 可以从指定的数组中取??
if ($input == array()) {
if (strpos($name, &#39;.&#39;)) {
// 指定参数来源
list($method, $name) = explode(&#39;.&#39;, $name, 2);
// 默认为post
$method = &#39;post&#39;;
switch (strtolower($method)) {
case &#39;get&#39;
$input = $_GET;
case &#39;post&#39;
$input = $_POST;
case &#39;put&#39;
parse_str(file_get_contents(&#39;php://input&#39;), $input);
case &#39;request&#39; :
$input = $_REQUEST;
case &#39;session&#39; :
$input = $_SESSION;
case &#39;cookie&#39;
$input = $_COOKIE;
case &#39;server&#39;
$input = $_SERVER;
case &#39;globals&#39; :
$input = $GLOBALS;
return NULL;
$value = isset($input[$name]) ? $input[$name] :
if (is_array($filter)) return in_array($value, $filter) ? $value : $
if (!is_string($filter)) return $
switch ($filter) {
case &#39;int&#39;:
return is_null($value) ? (is_null($default) ? 0 : $default) : intval($value);
case &#39;str&#39;:
return is_null($value) ? (is_null($default) ? &#39;&#39; : $default) : strval($value);
case &#39;arr&#39;:
return is_array($value) ? $value : (is_array($default) ? $default : array());
return empty($value) ? $default : (regex($value, $filter) ? $value : $default);
* 使用正则验证数据
* @param string $value 要验证的数据
* @param string $rule
* @return mixed
function regex($value, $rule) {
$validate = array(
&#39;require&#39; =& &#39;/.+/&#39;,
&#39;email&#39; =& &#39;/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/&#39;,
&#39;url&#39; =& &#39;/^http:\/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+[\/=\?%\-&_~`@\[\]\&#39;:+!]*([^&&\&\&])*$/&#39;,
&#39;currency&#39; =& &#39;/^\d+(\.\d+)?$/&#39;,
&#39;number&#39; =& &#39;/^\d+$/&#39;,
&#39;zip&#39; =& &#39;/^[0-9]\d{5}$/&#39;,
&#39;tel&#39; =& &#39;/^1[\d]{10}$/&#39;,
&#39;integer&#39; =& &#39;/^[-\+]?\d+$/&#39;,
//带小数点
&#39;double&#39; =& &#39;/^[-\+]?\d+(\.\d+)?$/&#39;,
//英文字母
&#39;english&#39; =& &#39;/^[a-zA-Z]+$/&#39;,
//中文汉字
&#39;chinese&#39; =& &#39;/^[\x{4e00}-\x{9fa5}]+$/u&#39;,
&#39;pinyin&#39; =& &#39;/^[a-zA-Z0-9\-\_]+$/&#39;,
&#39;username&#39; =& &#39;/^(?!_)(?!.*?_$)[a-zA-Z0-9_\x{4e00}-\x{9fa5}]{3,15}$/u&#39;,
//英文字符
&#39;en&#39; =& &#39;/^[a-zA-Z0-9_\s\-\.]+$/&#39;,
//中文字符
&#39;cn&#39; =& &#39;/^[\w\s\-\x{4e00}-\x{9fa5}]+$/u&#39;,
//安全字符??
&#39;safestring&#39; =& &#39;/^[^\$\?]+$/&#39;
// 检查是否有内置的正则表达式
if (isset($validate[strtolower($rule)])) $rule = $validate[strtolower($rule)];
return preg_match($rule, strval($value)) === 1;
* 链接生成
* @param string $method 对应方法
* @param array $args
* @param array $ignores 忽略参数
* @return string
function U($method = &#39;&#39;, $args = array(), $ignores = array()) {
static $rules = null, $_method = array(), $_map = array();
if ($rules === null) {
$rules = C(&#39;URL_RULES&#39;);
$_map = C(&#39;map_module&#39;);
//忽视args中的部分参数
if (!empty($ignores)) {
foreach ($ignores as $key =& $var) {
if (isset($args[$key]) && $args[$key] == $var) unset($args[$key]);
if (empty($_method[$method])) {
if (substr_count($method, &#39;.&#39;) == 1) {
$_method[$method] = MODULE_NAME . &#39;.&#39; . $
} elseif ($method === &#39;&#39;) {
$_method[$method] = MODULE_NAME . &#39;.&#39; . CONTROLLER_NAME . &#39;.&#39; . ACTION_NAME;
} elseif (substr_count($method, &#39;.&#39;) == 0) {
$_method[$method] = MODULE_NAME . &#39;.&#39; . CONTROLLER_NAME . &#39;.&#39; . $
$_method[$method] = $
$_method[$method] = strtolower($_method[$method]);
$method = $_method[$method];
if (!empty($rules[$method]) && empty($args[&#39;_force&#39;])) {
$keys = array();
$rule = $rules[$method];
foreach ($args as $key =& $arg) {
$keys[] = &#39;{&#39; . $key . &#39;}&#39;;
$url = clearUrl(str_replace($keys, $args, $rule));
if (strpos($url, &#39;]&#39;)) {
$url = strtr($url, array(&#39;[&#39; =& &#39;&#39;, &#39;]&#39; =& &#39;&#39;));
return PT_DIR . $
list($param[&#39;m&#39;], $param[&#39;c&#39;], $param[&#39;a&#39;]) = explode(&#39;.&#39;, $method);
//调整顺序为m c a
krsort($param);
$param = array_merge($param, $args);
if (isset($_map[$param[&#39;m&#39;]])) $param[&#39;m&#39;] = $_map[$param[&#39;m&#39;]];
return __APP__ . &#39;?&#39; . http_build_query($param);
* 清除url中可选参??
* @param $url
* @return mixed
function clearUrl($url) {
while (preg_match(&#39;#\[[^\[\]]*?\{\w+\}[^\[\]]*?\]#&#39;, $url, $match)) {
$url = str_replace($match[&#39;0&#39;], &#39;&#39;, $url);
* 去除代码中的空白和注??
* @param string $content 代码内容
* @return string
function strip_whitespace($content) {
$stripStr = &#39;&#39;;
//分析php源码
$tokens = token_get_all($content);
$last_space =
for ($i = 0, $j = count($tokens); $i & $j; $i++) {
if (is_string($tokens[$i])) {
$last_space =
$stripStr .= $tokens[$i];
switch ($tokens[$i][0]) {
//过滤各种PHP注释
case T_COMMENT:
case T_DOC_COMMENT:
//过滤空格
case T_WHITESPACE:
if (!$last_space) {
$stripStr .= &#39; &#39;;
$last_space =
case T_START_HEREDOC:
$stripStr .= &&&&ptcms\n&;
case T_END_HEREDOC:
$stripStr .= &\n&;
for ($k = $i + 1; $k & $j; $k++) {
if (is_string($tokens[$k]) && $tokens[$k] == &#39;;&#39;) {
} else if ($tokens[$k][0] == T_CLOSE_TAG) {
$last_space =
$stripStr .= $tokens[$i][1];
return $stripS
* block调用函数
* @param string $class block名称
* @param array $param
* @return mixed
function B($class, $param) {
$classname = strtolower($class);
$class = $classname . &#39;Block&#39;;
if (empty($_class[$class])) {
if (class_exists($class)) {
$_class[$class] = new $class();
echo &#39;使用的区块不存在,block method=&#39;.$
return &#39;&#39;;
return $_class[$class]-&run($param);
function runinfo() {
if (C(&#39;is_gen_html&#39;)) return &#39;&#39;;
$tpl = C(&#39;runinfo&#39;, null, &#39;Power by PTCMS, Processed in {time}(s), Memory usage: {mem}MB.&#39;);
$from[] = &#39;{time}&#39;;
$to[] = number_format(microtime(true) - $GLOBALS[&#39;_startTime&#39;], 3);
$from[] = &#39;{mem}&#39;;
$to[] = number_format((memory_get_usage() - $GLOBALS[&#39;_startUseMems&#39;]) / 1024 / 1024, 3);
if (strpos($tpl, &#39;{net}&#39;)) {
$from[] = &#39;{net}&#39;;
$to[] = count($GLOBALS[&#39;_api&#39;]);
if (strpos($tpl, &#39;{file}&#39;)) {
$from[] = &#39;{file}&#39;;
$to[] = count(get_included_files());
if (strpos($tpl, &#39;{sql}&#39;)) {
$from[] = &#39;{sql}&#39;;
$to[] = count($GLOBALS[&#39;_sql&#39;]);
if (strpos($tpl, &#39;{cacheread}&#39;)) {
$from[] = &#39;{cacheread}&#39;;
$to[] = $GLOBALS[&#39;_cacheRead&#39;];
if (strpos($tpl, &#39;{cachewrite}&#39;)) {
$from[] = &#39;{cachewrite}&#39;;
$to[] = $GLOBALS[&#39;_cacheWrite&#39;];
$runtimeinfo = str_replace($from, $to, $tpl);
function is_mobile() {
// 如果有HTTP_X_WAP_PROFILE则一定是移动设备
if (isset ($_SERVER[&#39;HTTP_X_WAP_PROFILE&#39;])) {
// 如果via信息含有wap则一定是移动设备,部分服务商会屏蔽该信??
if (isset ($_SERVER[&#39;HTTP_VIA&#39;])) {
// 找不到为flase,否则为true
return stristr($_SERVER[&#39;HTTP_VIA&#39;], &wap&) ? true :
// 脑残法,判断手机发送的客户端标??兼容性有待提??
if (isset ($_SERVER[&#39;HTTP_USER_AGENT&#39;])) {
$clientkeywords = array(&#39;nokia&#39;, &#39;sony&#39;, &#39;ericsson&#39;, &#39;mot&#39;, &#39;samsung&#39;, &#39;htc&#39;, &#39;sgh&#39;, &#39;lg&#39;, &#39;sharp&#39;, &#39;sie-&#39;, &#39;philips&#39;, &#39;panasonic&#39;, &#39;alcatel&#39;, &#39;lenovo&#39;, &#39;iphone&#39;, &#39;ipod&#39;, &#39;blackberry&#39;, &#39;meizu&#39;, &#39;android&#39;, &#39;netfront&#39;, &#39;symbian&#39;, &#39;ucweb&#39;, &#39;windowsce&#39;, &#39;palm&#39;, &#39;operamini&#39;, &#39;operamobi&#39;, &#39;openwave&#39;, &#39;nexusone&#39;, &#39;cldc&#39;, &#39;midp&#39;, &#39;wap&#39;, &#39;mobile&#39;, &#39;UCBrowser&#39;);
// 从HTTP_USER_AGENT中查找手机浏览器的关键字
if (preg_match(&/(& . implode(&#39;|&#39;, $clientkeywords) . &)/i&, strtolower($_SERVER[&#39;HTTP_USER_AGENT&#39;]))) {
// 协议法,因为有可能不准确,放到最后判??
if (isset ($_SERVER[&#39;HTTP_ACCEPT&#39;])) {
// 如果只支持wml并且不支持html那一定是移动设备
// 如果支持wml和html但是wml在html之前则是移动设备
if ((strpos($_SERVER[&#39;HTTP_ACCEPT&#39;], &#39;vnd.wap.wml&#39;) !== false) && (strpos($_SERVER[&#39;HTTP_ACCEPT&#39;], &#39;text/html&#39;) === false || (strpos($_SERVER[&#39;HTTP_ACCEPT&#39;], &#39;vnd.wap.wml&#39;) & strpos($_SERVER[&#39;HTTP_ACCEPT&#39;], &#39;text/html&#39;)))) {
// 判断是否是蜘??
function is_spider($ua = &#39;&#39;) {
empty($ua) && $ua = $_SERVER[&#39;HTTP_USER_AGENT&#39;];
$ua = strtolower($ua);
$spiders = array(&#39;bot&#39;, &#39;crawl&#39;, &#39;spider&#39;, &#39;slurp&#39;, &#39;sohu-search&#39;, &#39;lycos&#39;, &#39;robozilla&#39;);
foreach ($spiders as $spider) {
if (false !== strpos($ua, $spider))
//获取客户端ip
function get_ip($default = &#39;0.0.0.0&#39;) {
$ip=$_SERVER[&#39;REMOTE_ADDR&#39;];
$i = explode(&#39;.&#39;, $ip);
if ($i[0] == 10 || ($i[0] == 172 && $i[1] & 15 && $i[1] & 32) ||($i[0] == 192 && $i[1] == 168)){
//如果是内网ip重新获取
$keys = array(&#39;HTTP_X_FORWARDED_FOR&#39;, &#39;HTTP_CLIENT_IP&#39;);
foreach ($keys as $key) {
if (empty($_SERVER[$key]))
$ips = explode(&#39;,&#39;, $_SERVER[$key], 1);
$ip = $ips[0];
$l = ip2long($ip);
if ((false !== $l) && ($ip === long2ip($l))) return $
* 获取自动加载的目录文??
* @return array
function get_auto_map() {
$map = array();
$dirs = explode(&#39;,&#39;, trim((C(&#39;allow_module&#39;, null, &#39;&#39;) . &#39;,common&#39;), &#39;,&#39;));
foreach ($dirs as $dir) {
$path = APP_PATH . &#39;/&#39; . $
if (!is_dir($path))
$handle = opendir($path);
while (($dirname = readdir($handle)) !== false) {
if (in_array($dirname, array(&#39;model&#39;, &#39;block&#39;, &#39;library&#39;))) {
$handle1 = opendir($path . &#39;/&#39; . $dirname);
while (($filename = readdir($handle1)) !== false) {
if (substr($filename, -4) == &#39;.php&#39;) {
$map[$dirname][substr($filename, 0, -4)][$dir] = $path . &#39;/&#39; . $dirname . &#39;/&#39; . $
closedir($handle1);
closedir($handle);
Copyright(C)
OKBASE.NET All Rights Reserved 好库网 版权所有

我要回帖

更多关于 域名后面必须加一个点 的文章

 

随机推荐