PHPCMS的使用
2018-06-22 05:26:50来源:未知 阅读 ()
1.下载安装phpcms
下载完后解压将install_packages上传到服务器并重命名为phpcms_test:
更改目录文件系统权限:
chmod -R 777 phpcms_test
配置nginx访问:
server {
root C:/Users/liudaoqiang/project_test/phpcms_test/;
index index.html index.php;
server_name dev.phpcms_test.com;
# set $yii_bootstrap "index.html";
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index $yii_bootstrap;
try_files $uri $uri/ $yii_bootstrap?$args;
if (!-e $request_filename) {
rewrite (.*) /index.php/$1;
}
}
location ~ ^/(protected|framework|nbproject|themes/\w+/views) {
deny all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 7d;
}
#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
#fastcgi_next_upstream error timeout invalid_header http_500 http_503 http_404;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
location ~ /\.ht {
deny all;
}
}
配置hosts文件:
127.0.0.1 dev.phpcms_test.com
启动php-fpm及nginx:
start nginx
nginx -s reload
访问http://dev.phpcms_test.com/install/install.php进入安装程序:
登录后台管理系统:
进入前台首页:
2.phpcms模板标签
pc标签:
{pc:content action="lists" catid="25" num="20" page="$_GET[page]" return="data"}
<ul>
{loop $data $n $r}
<li><a href="{$r[url]}">{$r[title]}</a></li>
{/loop}
</ul>
{/pc}
json工具标签:
{pc:json url="http://www.phpcms.cn/12.php" cache="86400"}
<ul>
{loop $data $key $val}
<li><a href="{$val[url]}">{$val['title']}</a></li>
{/loop}
</ul>
{/pc}
xml工具标签:
{pc:xml url="http://www.phpcms.cn/12.php" cache="86400"}
<ul>
{loop $data $key $val}
<li><a href="{$val[url]}">{$val['title']}</a></li>
{/loop}
</ul>
{/pc}
get标签:
{pc:get sql="SELECT * FROM phpcms_member" cache="3600" page="$page" dbsource="discuz" return="data"}
<ul>
{loop $data $key $val}
{$val[username]}<br />
{/loop}
</ul>
{$pages}
{/pc}
例:评论模块获取评论列表并展示:
{pc:comment action="lists" commentid="$commentid"}
<ul>
{loop $data $key $val}
<li> {$val[url]}于{format::date($val[creat_at], 1)}发布,他支持{direction($v[direction])}<br>{$val[content]}</li>
{/loop}
</ul>
{/pc}
例:获取会员模块的收藏文章列表:
{pc:member action="favoritelist" userid="$userid" order="id DESC" num="10"}
<ul class="title-list">
{loop $data $k $v}
<li>·<a href="{$v['url']}" target="_blank">{$v['title']}</a><span><em>{format::date($v['adddate'], 1)}</em> </span></li>
{/loop}
</ur>
{/pc}
3.phpcms的二次开发
phpcms的目录结构:
phpcms的ur访问:
系统类库与函数库调用:
?>
static $configs = array();
if (!$reload && isset($configs[$file])) {
if (empty($key)) {
return $configs[$file];
} elseif (isset($configs[$file][$key])) {
return $configs[$file][$key];
} else {
return $default;
}
}
$path = CACHE_PATH.'configs'.DIRECTORY_SEPARATOR.$file.'.php';
if (file_exists($path)) {
$configs[$file] = include $path;
}
if (empty($key)) {
return $configs[$file];
} elseif (isset($configs[$file][$key])) {
return $configs[$file][$key];
} else {
return $default;
}
}
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:PHP
- 详解php中的implements 使用 2020-03-18
- PHP实现打包下载文件的方法示例 2020-03-17
- PHP简单留言本功能实现代码 2020-03-13
- PHP中APC缓存配置及使用详解 2020-03-04
- ThinkPHP分页类使用详解 2020-02-24
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash