PHPCMS的使用
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;
}
}
PHPCMS的使用的更多相关文章
- phpcms二次开发中无法获取SESSION的值
今天在在phpcms开发留言板用到验证码,提交数据,后台无法$_SESSION['code']无法获取验证码值,也无法打印var_dump($_SESSION)值,我们只需要在文件头部添加如下代码: ...
- 12月5日PHPCMS替换主页
cms替换主页的步骤 1.先做好静态页面: 2.在D:\wamp\www\phpcms\install_package\phpcms\templates文件夹下建新的文件夹tianqiwangluo( ...
- 12月4日PHPCMS模板
cms的样式有很多种,我们学习的是phpcms,这些cms都是大同小异,学会了一种就可以使用其它的cms. PHPCMS是一款网站管理软件.该软件采用模块化开发,支持多种分类方式,使用它可方便实现个性 ...
- phpcms 添加memcache支持
1,修改caches/configs/cache.php <?php return array ( 'file1' => array ( 'type' => 'file', 'deb ...
- phpcms调取数据库的两种机制
在phpcms中,模板调取后台的数据有两种机制: 1.在控制器中定义数据,在模板中直接调用. 2.标签机制.即在模块的classes/tag.class中定义标签类,然后在模板中用标签调用 两种调用机 ...
- phpcms 表单提交发送邮件
修改 phpcms\modules\formguide index.php 找到 foreach ($mails as $m) { sendmail($m, L('tips'), $this-> ...
- PHPCMS v9 安全防范教程
一.目录权限设置很重要:可以有效防范黑客上传木马文件.如果通过 chmod 644 * -R 的话,php文件就没有权限访问了.如果通过chmod 755 * -R 的话,php文件的权限就高了. 所 ...
- phpcms 整合 discuz!
第一步,进入discuz后台,点击UCenter菜单,然后点击应用管理,接着点击右侧的添加新应用按钮 然后填写应用相关信息: 1.应用类型选择“其他” 2.应该名称填写“phpcms” //此处可以自 ...
- phpcms V9 整合 Discuz! X2 教程
整合原理: UCenter 作服务端:phpsso 与 Discuz! 分别作 UCenter 的客户端应用:phpsso 与 Discuz! 通过 UCenter 发生交互. phpcms 通过 p ...
- phpcms文章点击量统计方法
phpcms用户广大,很好用,很傻瓜.设计思路也很好,对cms的常见功能都有设计,可以作为自己开发的参考. 最近看了下phpcms的源码关于文章点击量统计的这块,自己记录下. 默认文章点击量显示的位置 ...
随机推荐
- Node.js使用TCP通讯
原文地址:https://www.cnblogs.com/ay-a/p/9822057.html Node.js 的 net 模块可以方便的创建TCP 服务,,以下是使用 net 模块创建的tcp 服 ...
- pytorch visdom可视化工具学习—1—详细使用-3-Generic Plots和Others
4)Generic Plots 注意,服务器API遵循数据和布局对象的规则,这样您就可以生成自己的任意Plotly可视化: # Arbitrary visdom content trace = dic ...
- 项目代码迁移(使用git)
克隆老仓库(裸仓库):git clone --bare git@codehub.devcloud.huaweicloud.com:e2f197xxxxxxx19fc4ae7348b2ed41/Node ...
- Java多线程(七)——线程休眠
一.sleep()介绍 sleep() 定义在Thread.java中.sleep() 的作用是让当前线程休眠,即当前线程会从“运行状态”进入到“休眠(阻塞)状态”.sleep()会指定休眠时间,线程 ...
- Linux中断管理 (1)Linux中断管理机制
目录: <Linux中断管理> <Linux中断管理 (1)Linux中断管理机制> <Linux中断管理 (2)软中断和tasklet> <Linux中断管 ...
- python内置的高效好用各种库
二分查找,import bisect 堆排序,import heapq 哈希算法,import hashlib 压缩,lzma 图形处理,PIL 处理xml文件,PyXML 多媒体操作,PyMedia ...
- Git-命令行-使用 Tag 标记你的代码
前言 正文开始之前,我想我们需要弄明白几个问题: 1.tag 是什么? 2.使用tag 的好处? 3.tag 和 branch 的区别以及使用场景? tag 是什么? tag , 翻译过来是标签的意思 ...
- LeetCode 961. N-Repeated Element in Size 2N Array
In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeate ...
- uva11300 分金币(中位数)
来源:https://vjudge.net/problem/UVA-11300 题意: 有n个人围成一圈,每个人有一定数量的金币,每次只能挪动一个位置,求挪动的最少金币使他们平分金币 题解: 蓝书p6 ...
- c++入门之初话结构体
结构体是一种具有一定数据结构思想的数据类型,我们在对待结构体的时候,用该从数据结构的思想去审视结构体.下面给出结构体的定义 struct mystruct {]; int score; double ...