6 Star 21 Fork 7

琪耀 / Cxuu-PHP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

龙啸轩WEB.PHP 简易内容管理系统

  • 基于 ZPHP-mini 和 layui构建,简单高效!!简单粗暴!!

版本: V3.7.4

前端

  • 支持页面数据定制灵活调用;

  • 首页自动纯静态生成;

  • 视图页自动静态化,可动态开关和设置静态化时间;

  • Redis\memcache\file文件缓存,可以自由定制(设置)缓存时间;

  • 前端包括:文章、图集、成员显示、值班安排、访问统计等;(这些模块只是提供了一些实用场景的制作思路,你可以根据自己实际需要扩展所需要功能)

  • 灵活路由方式;

  • 独立搜索模块;

  • 在线提交意见反馈;

  • ......

后台

  • 灵活角色、管理员权限;

  • 多语言支持

  • 便捷的栏目管理;

  • 系统公告;

  • 灵活的系统设置;

  • 缓存管理;

  • 实用功能包括:值班安排管理、图集管理、内部成员管理、意见反馈、应用链接、视频、专题等;

  • 前台访问计数统计;

  • 数据库操作日志;

  • 其它功能。

开发文档

  • 系统采用PHP框架和UI框架非侵入式编写,可完全参照框架文档进行二次开发

Z-PHP-mini框架

文档:https://www.showdoc.cc/zphp4

系统安装

  • 网站要求环境伪静态支持!

环境需求

  • php 7.1+ php8.0+

  • mysql 5.6+ or mariadb 10.0+

  • Aapache\Nginx\IIS等

目录绑定

  • WEB目录请绑定在:/public

  • 后台访问地址:xxx.com/admin

数据库

  • 创建一个MYSQL数据库,再导入数据文件 数据库是根目录的cxuuweb_php.sql,直接导入数据库即可,数据库配置文件在根目录的common/config.php
'DB' => [
	'dsn' => 'mysql:host=127.0.0.1;dbname=cxuuweb;port=3306',
	'db' => 'cxuuweb',//数据库名,要对应上面的dbname 填写一样的名称即可
	'user' => 'root',
	'pass' => '***',  //密码
	'charset' => 'utf8',
	'prefix' => 'cxuu_',
	'cache_mod' => 0, //查询数据库缓存模式:1:redis, 2:memcached, 默认:0 文件
],
  • 后台 默认的 用户名:admin 密码:123456

注意

  • 前台默认开启了缓存及路由模式

  • 本源码默认是 DEBUG模式,如正式上线使用,请关闭。 /common/config.php

    !!如在使用中报错,请先检查根目录下的/common/config.php的

'DEBUG' => [
	'level' => 3,//debug级别:0:关闭,1:只显示运行信息,2:显示运行和错误信息,3:显示运行、错误、警告信息
	'log' => 1,//日志级别:0:不记录,1:只记录错误,2:记录错误和警告
	'type' => 'json',//输出格式	auto, html,json    默认:auto
],
'ROUTER' => [
	'mod' => 0, //不建议修改,系统前台采用了路由模式
	'module' => false,
	'restfull' => 0,
]

前端使用

本系统使用比较简单,在程序内部和模板上都有相应注释

这里主要说明一些较常用的前台使用方法,后台部分有特别使用的地方均做了相应提示,在使用上不会存在障碍!

  • 前端一般采用php原生写法,也可以参照框架前端文档用框架约定方式输出,两者在性能上没有区别,只是个人习惯而已。

  • 系统贯彻追求原生速度原则,在模板制作上均采取原始方法制作。

  • 本系统缓存均为全自动管理,前端发布内容后,会根据自定义时间进行缓存更新,如需要即时显示,需在后台清理数据库缓存。在生产环境模式中,修改了模板需要清除前后端对应的程序缓存!!

内容列表前端调用方法

方法一

<?php foreach(CxuuList("table='article' cid='1,2,3' limit='10' cache='600' imgbl='0' attribute='0' order='id DESC'") as $vo){?> 
	echo $vo['title']; //标题
	echo urlInfo($vo['id']); //按照路由模式生成相应的 链接地址
	echo FTime($vo['time'],'m-d'); //生成格式化时间
<?php }?>
table : 数据表
cid:栏目CID 如: 2 ,多个栏目:"3,6,5" 或 0全部栏目;
limit :条数 支持偏移如:"2,10";
cache :缓存时间 600单位秒;
imgbl :是否图片 1 0;
attribute :是否头条 1 或小头条 2 或 图片轮换 3;
order : 排序

方法二

<?php foreach(\model\article::selectData('3,6',5,60,1,3) as $vo){
	echo $vo['title']; //标题
	echo urlInfo($vo['id']); //按照路由模式生成相应的 链接地址
	echo FTime($vo['time'],'m-d'); //生成格式化时间
	..........
}?>
关于 selectData('3,6',5,60,1,3) 说明:
1、CID单个栏目直接填写数据 如: 2 ,多个栏目:"3,6,5" 或 0全部栏目;
2、条数 支持偏移如:"2,10";
3、缓存时间 600单位秒;
4、是否图片 1;
5、是否头条 1 或小头条 2 或 图片轮换 3;
  • 带栏目信息调用
foreach(\model\article::selectJoinData(7,5,60) as $vo){
	echo $vo['catename']; //栏目名称
	...
 }
$cid = 栏目ID   $limit  = 1,10条数,  $cache  = 缓存时间 秒

栏目列表

方法一:

<?php foreach(CxuuList("table='article_cate' id='1,2,3' cache='600' order='sort DESC'") as $vo){?> 
	<?php echo $vo['name']; ?>
<?php }?>

方法二:

<?php foreach(\model\common::getCateList('6,7,8,9,10',0,'sort DESC') as $value){ ?>
	 <li class="layui-nav-item <?php if($value['id']==$cid) echo 'layui-this';?>"><a href="<{ urlList($value['id']) }>" target="_blank"><{$value['name']}></a></li>
<?php }?>

值班安排调用(可根据实际使用场景自定义)


<?php $ondutyInfo = CxuuList("table='onduty'"); ?>
或:
<?php $ondutyInfo = \model\ondutys::findData(); ?>  //在当前模板中获取到模型变量

今日(<?php echo $ondutyInfo['ondutytime'];?>) 值班 -
公司领导:<b> <?php echo $ondutyInfo['juname'];?></b>
部门领导:<b> <?php echo $ondutyInfo['chuname'];?></b>
值班员:<b> <?php echo $ondutyInfo['yuanname'];?></b>

路由模式下的链接生成方法

1、echo urlInfo($vo['id']);  生成内容页链接
2、echo urlList($vo['id']);  生成ID列表页链接

 urlList($vo['urlname']);  生成自定义URL链接
或自动判断:
 <?php if(!empty($value['urlname'])){echo urlList($value['urlname']); }else{ echo urlList($value['id']);} ?>


3、echo urlImage($vo['id']);  生成图集内容页链接
4、echo urlFeedback($vo['id']);  生成留言反馈内容页链接

截取字符长度

 如:echo MbStr($vo['title'],20);  显示20个字符,支持中文

格式化时间显示

1、显示多久以前   echo HTime($info['time']);
2、格式化时间     echo FTime($vo['time'],'Y-m-d');  Y-m-d 为显示样式

图集调用方法

<?php foreach(CxuuList("table='images'") as $vo){?>
或:
<?php foreach((array)\model\images::selectData() as $vo){?>
	<li>
		<div class="pic"><a href="<?php echo urlImage($vo['id']);?>" target="_blank"><img src="<?php echo $vo['img'];?>" /></a></div>
		<div class="title"><a href="<?php echo urlImage($vo['id']);?>" target="_blank"><?php echo MbStr($vo['title'],22);?></a></div>
	</li>
<?php }?>

分页(两种样式)


- 调用方法,在列表页加入以下这段代码即可(为了前端框架非依赖性,制作了除LAYUI分页外的单独分页CSS样式):

<?php CxuuPage($page,1);?>

- 分页样式适用所有类型列表,第二个参数0或空时为原生样式,1 为LAYUI样式 设置为1时,需要配置对应的 LAYUI JS参数(内容列表模板里有参考)

CSS样式 \public\res\index\css\main.css:
/*原生分页代码*/
#page{margin:auto;height:50px;line-height:50px;}
.manu {font-size:16px;PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; MARGIN: 3px; PADDING-TOP: 3px; TEXT-ALIGN: center}
.manu A {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #036cb4; PADDING-TOP: 2px; TEXT-DECORATION: none}
.manu A:hover {COLOR: #fff;BACKGROUND-COLOR: #036cb4;}
.manu A:active {BORDER-RIGHT: #036cb4 1px solid; BORDER-TOP: #036cb4 1px solid; BORDER-LEFT: #036cb4 1px solid; COLOR: #666; BORDER-BOTTOM: #036cb4 1px solid}
.manu .current {PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-WEIGHT: bold; PADDING-BOTTOM: 2px; MARGIN: 2px; COLOR: #fff; PADDING-TOP: 2px; BACKGROUND-COLOR: #036cb4}
.manu .current a{FONT-WEIGHT: bold; COLOR: #fff; }
.manu .disabled {BORDER: #036cb4 1px solid; PADDING-RIGHT: 5px; PADDING-LEFT: 5px; PADDING-BOTTOM: 2px; MARGIN: 2px;  COLOR: #ddd; PADDING-TOP: 2px; }

系统配置调用

<?php echo siteInfo('copyright');?>//版权信息
<title><?php echo siteInfo('sitename');?></title>//网站名称
<meta name="keywords" content="<?php echo siteInfo('keywords');?>">
<meta name="description" content="<?php echo siteInfo('descript');?>">
.......

访问统计(异步方式)

  • html


本站访问统计(PV值 缓存10分钟更新)
今日访问:<span class="visit_today"></span>
昨日:<span class="visit_yesterday"></span>
总访问:<span class="visit_sum"></span>
最高日访问:<span class="visit_max"></span>
  • jq


$.getJSON('/visit', {}, function (data) {
	$('.visit_today').text(data['today']);
	$('.visit_yesterday').text(data['yesterday']);
	$('.visit_sum').text(data['sum']);
	$('.visit_max').text(data['max']);
})

获取及设置数据缓存方法


(这是一个基于框架提取出来的内置方法,可以将想要储存为缓存的任意数据进行缓存,与前端设置无关,当然,也可以灵活利用)
1、设置缓存方法:
<?php SetCxuuCache($key,$data,600);?> //自定义缓存健,要缓存的数据,缓存时间
2、获取缓存方法:
<?php GetCxuuCache($key);?> //通过健名获取对应数据

获取栏目列表

getCateList('6,7,8,9,10');
值为栏目ID,为空时,获取所有栏目信息

<?php foreach(\model\common::getCateList('6,7,8,9,10') as $value){ ?>
	<li class="layui-nav-item"><a href="<{ urlList($value['id']) }>" target="_blank"><{$value['name']}></a></li>
<?php }?>

获取栏目路深度

示例:  首页/ 产品列表/电子产品
<?php 
	foreach(\model\common::getCateUrlData($cid) as $value){
		if($value['type'] == 0){
			echo '<a>'.$value['name'].'</a>';
		}else{
			echo '<a href="'.urlList($value['id']).'"><cite>'.$value['name'].'</cite></a>';
		}
	}
?>

获取应用链接

<?php foreach((array)\model\applinks::AppLinkList(8) as $vo){?>
	<div class="layui-col-md6 cxuu-applink-a">
		<a href="<{$vo['url']}>" target="_blank"><i class="fontsize layui-icon <{$vo['ico']}>"></i><br><{$vo['name']}></a>
	</div>
<?php }?>

AppLinkList(8)
参数为显示条数

前端模板更多用法可参考现有模板示例

Apache License Version 2.0, January 2004http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2020 Z-PHP Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

简介

基于Z-PHP 和 Layui构建,便捷模板制作,灵活用户权限,高效管理后台。媲美编绎语言的性能,灵活高效!简单粗暴!扩展灵活! 展开 收起
Apache-2.0
取消

发行版 (16)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/4856742/cxuu.git
git@gitee.com:4856742/cxuu.git
4856742
cxuu
Cxuu-PHP
master

搜索帮助