作者 liyuhang

csdm

要显示太多修改。

为保证性能只显示 49 of 49+ 个文件。

ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
Apache Licence是著名的非盈利开源组织Apache采用的协议。
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
允许代码修改,再作为开源或商业软件发布。需要满足
的条件:
1. 需要给代码的用户一份Apache Licence ;
2. 如果你修改了代码,需要在被修改的文件中说明;
3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
带有原来代码中的协议,商标,专利声明和其他原来作者规
定需要包含的说明;
4. 如果再发布的产品中包含一个Notice文件,则在Notice文
件中需要带有本协议内容。你可以在Notice中增加自己的
许可,但不可以表现为对Apache Licence构成更改。
具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
... ...
ThinkPHP 5.0
===============
[![Total Downloads](https://poser.pugx.org/topthink/think/downloads)](https://packagist.org/packages/topthink/think)
[![Latest Stable Version](https://poser.pugx.org/topthink/think/v/stable)](https://packagist.org/packages/topthink/think)
[![Latest Unstable Version](https://poser.pugx.org/topthink/think/v/unstable)](https://packagist.org/packages/topthink/think)
[![License](https://poser.pugx.org/topthink/think/license)](https://packagist.org/packages/topthink/think)
ThinkPHP5在保持快速开发和大道至简的核心理念不变的同时,PHP版本要求提升到5.4,对已有的CBD模式做了更深的强化,优化核心,减少依赖,基于全新的架构思想和命名空间实现,是ThinkPHP突破原有框架思路的颠覆之作,其主要特性包括:
+ 基于命名空间和众多PHP新特性
+ 核心功能组件化
+ 强化路由功能
+ 更灵活的控制器
+ 重构的模型和数据库类
+ 配置文件可分离
+ 重写的自动验证和完成
+ 简化扩展机制
+ API支持完善
+ 改进的Log类
+ 命令行访问支持
+ REST支持
+ 引导文件支持
+ 方便的自动生成定义
+ 真正惰性加载
+ 分布式环境支持
+ 更多的社交类库
> ThinkPHP5的运行环境要求PHP5.4以上。
详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5)
## 目录结构
初始的目录结构如下:
~~~
www WEB部署目录(或者子目录)
├─application 应用目录
│ ├─common 公共模块目录(可以更改)
│ ├─module_name 模块目录
│ │ ├─config.php 模块配置文件
│ │ ├─common.php 模块函数文件
│ │ ├─controller 控制器目录
│ │ ├─model 模型目录
│ │ ├─view 视图目录
│ │ └─ ... 更多类库目录
│ │
│ ├─command.php 命令行工具配置文件
│ ├─common.php 公共函数文件
│ ├─config.php 公共配置文件
│ ├─route.php 路由配置文件
│ ├─tags.php 应用行为扩展定义文件
│ └─database.php 数据库配置文件
├─public WEB目录(对外访问目录)
│ ├─index.php 入口文件
│ ├─router.php 快速测试文件
│ └─.htaccess 用于apache的重写
├─thinkphp 框架系统目录
│ ├─lang 语言文件目录
│ ├─library 框架类库目录
│ │ ├─think Think类库包目录
│ │ └─traits 系统Trait目录
│ │
│ ├─tpl 系统模板目录
│ ├─base.php 基础定义文件
│ ├─console.php 控制台入口文件
│ ├─convention.php 框架惯例配置文件
│ ├─helper.php 助手函数文件
│ ├─phpunit.xml phpunit配置文件
│ └─start.php 框架入口文件
├─extend 扩展类库目录
├─runtime 应用的运行时目录(可写,可定制)
├─vendor 第三方类库目录(Composer依赖库)
├─build.php 自动生成定义文件(参考)
├─composer.json composer 定义文件
├─LICENSE.txt 授权说明文件
├─README.md README 文件
├─think 命令行入口文件
~~~
> router.php用于php自带webserver支持,可用于快速测试
> 切换到public目录后,启动命令:php -S localhost:8888 router.php
> 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。
## 命名规范
`ThinkPHP5`遵循PSR-2命名规范和PSR-4自动加载规范,并且注意如下规范:
### 目录和文件
* 目录不强制规范,驼峰和小写+下划线模式均支持;
* 类库、函数文件统一以`.php`为后缀;
* 类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致;
* 类名和类文件名保持一致,统一采用驼峰法命名(首字母大写);
### 函数和类、属性命名
* 类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,默认不需要添加后缀,例如`UserController`应该直接命名为`User`
* 函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`
* 方法的命名使用驼峰法,并且首字母小写,例如 `getUserName`
* 属性的命名使用驼峰法,并且首字母小写,例如 `tableName`、`instance`
* 以双下划线“__”打头的函数或方法作为魔法方法,例如 `__call` 和 `__autoload`
### 常量和配置
* 常量以大写字母和下划线命名,例如 `APP_PATH`和 `THINK_PATH`
* 配置参数以小写字母和下划线命名,例如 `url_route_on` 和`url_convert`
### 数据表和字段
* 数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 `think_user` 表和 `user_name`字段,不建议使用驼峰和中文作为数据表字段命名。
## 参与开发
请参阅 [ThinkPHP5 核心框架包](https://github.com/top-think/framework)
## 版权信息
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
本项目包含的第三方源码和二进制文件之版权信息另行标注。
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
All rights reserved。
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
更多细节参阅 [LICENSE.txt](LICENSE.txt)
... ...
deny from all
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: asus
* Date: 2019/3/13
* Time: 10:30
*/
return [
'200'=>'返回成功',
'202'=>'请求失败',
];
\ No newline at end of file
... ...
<?php
namespace app\api\controller;
use app\admin\controller\Base;
use app\admin\model\AdminLog as AdminLogModel;
class AdminLog extends Base
{
/**
* @name:日志列表
* @return void
* @author :liyuhang
* @method :get
*/
public function lists(){
//搜索条件处理
if(isset($this->param['text']) && !empty($this->param['text'])){
$this->param['text'] = ['like','%'.$this->param['text'].'%'];
}
$adminLogModel = new AdminLogModel();
$lists = $adminLogModel->manager()->where($this->param)->page($this->p, $this->row)->order('id desc')->select()->toArray();
$this->allCount = $adminLogModel->allCount;
$this->result($lists);
}
}
\ No newline at end of file
... ...
<?php
namespace app\admin\controller;
use think\Cache;
use think\Config;
use think\Request;
use think\Response;
class Base
{
protected $method; // 当前请求类型
protected $type; // 当前资源类型
// 输出类型
protected $_btw = [0, 0]; // 时间区间等
protected $url = '';//分享地址
protected $restMethodList = 'post,get';
protected $restDefaultType = '';
protected $header = []; //输出header数据
protected $request = [];
protected $accessToken = '';
protected $p = 1; //分页页数
protected $order = ""; //排序
protected $row = 10; //默认分页数
protected $user = []; //登录对象
protected $uid = 0;
protected $param = []; //post参数
protected $map = [];//post处理过后的参数
protected $allCount = 0; //数据总条数
protected $token = ''; //token
protected $allow_fun = [//登录不需要验证的方法
'com'=>'*',
'user'=>',login,'
];
/**
* @name:公共方法参数处理
*/
public function __construct(Request $request)
{
session_start();
// 指定允许其他域名访问
$http_origin = "*";
if(isset($_SERVER['HTTP_ORIGIN'])){
$http_origin = $_SERVER['HTTP_ORIGIN'];
}
header("Access-Control-Allow-Origin:".$http_origin);
header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
exit;
}
$this->request = $request;
$this->method = $request->method();
$this->param = $request->param();
$this->map = $request->get();
$this->get_data();
$this->validate();
$this->authToken();
}
/**
* @name:判断当前状态是否登录
*/
private function authToken() {
$ctr = strtolower($this->request->controller());
$action = strtolower($this->request->action());
if(isset($this->allow_fun[$ctr]) && (($this->allow_fun[$ctr] == '*') || strpos($this->allow_fun[$ctr], sprintf(',%s,', $action)) > -1)){
return;
}
if (isset($this->param['token']) && !empty($this->param['token'])) {
$this->accessToken = $this->param['token'];
} else {
$this->accessToken = $this->request->header('token');
}
if(!Cache::has($this->accessToken)){
$this->response('请登录!', 202,[]);
}
//获取当前的session_id
$cache = Cache::get($this->accessToken);
if(!$cache){ //由于机器人没法登陆,需要跳过登陆验证
$this->response('请登录!', 202,[]);
}
$this->user = $cache;
if($cache){
$this->uid = $this->user['id'];
}
}
/**
* 验证
* @return
*/
private function validate() {
if (false === stripos($this->restMethodList, $this->method)) {
// 请求方式非法 则用默认请求方法
$this->response('请求方式非法', 203, '只允许' . $this->restMethodList);
}
$ctr = strtolower($this->request->controller());
$action = strtolower($this->request->action());
$config = Config::get('validate.'.$ctr.'_'.$action);
if(isset($config) && !empty($config)){
if(false === stripos($config['allow_method'], $this->method)){
$this->response('请求方式错误',203,'只允许'.$config['allow_method']);
}else{
$this->response('请配置请求方式',203,[]);
}
}
}
/**
* @name:get所有参数处理
*/
private function get_data() {
//获取兼容路由参数
$get_data = array_merge($this->map, $this->request->route());
foreach ($get_data as $k => $v) {
if(is_array($v)){
continue;
}
switch ($k) {
case "order":
strpos($v, "-") > -1 ? $v = str_replace("-", " ", $v) : $v = $v . " desc";
$this->order = $v;
break;
case "p":
$this->p = $v;
break;
case "row":
$this->row = $v;
break;
case "name":
$this->map[$k] = ['like','%'.$v.'%'];
break;
case "start":
$this->_btw[0] = $v;
$this->_btw[1] = date('Y-m-d H:i:s',time());
$this->map['created_time'] = ['between', $this->_btw];
break;
case "end":
$this->_btw[1] = $v;
$this->map['created_time'] = ['between', $this->_btw];
break;
case "debug":
defined("DEBUG") || define("DEBUG", $v);
break;
case 'XDEBUG_SESSION_START':
break;
default:
if (!empty($v)) {
$this->map[$k] = $v;
}
break;
}
}
}
/**
* 生成图片文件地址
* @param type $sha1 sha1
* @param type $type image
* @return type
*/
function getFileUrl($sha1, $type = 'image')
{
$url = '';
switch ($type) {
case 'image':
if (strpos($sha1, "http://") !== false) {
$url = $sha1;
} else {
$url = $sha1 ? url('/image/' . $sha1, '', '', true) : '';
}
break;
case 'images':
break;
case 'file':
$url = $sha1 ? url('/file/' . $sha1, '', '',true) : '';
break;
}
return $url;
}
/**
* REST 调用
* @access public
* @param string $method 方法名
* @return mixed
* @throws Exception
*/
public function _empty($method) {
$this->response('非法操作=>' . $method, 404);
}
/**
* 通用数据输出
* @param $msg
* @param $code
* @param $data
* @param $result_code
* @param $type
* @return
*/
protected function response($msg, $code = 200, $data = '', $result_code = null, $type = 'json') {
$result_code === null && $result_code = $code;
$result = [
'code' => $result_code,
'msg' => $msg,
'data' => $this->_extents($data),
];
$this->setHeader('X_End_Time', $this->request->time());
$response = Response::create($result, $type)->code($code)->header($this->header);
throw new \think\exception\HttpResponseException($response);
}
/**
* @name:返回参数处理
*/
protected function _extents($data) {
if (empty($data) || !is_array($data)) {
return empty($data) ? is_array($data) ? [] : '' : $data;
}
foreach ($data as $k => $v) {
if (is_array($v)) {
$data[$k] = $this->_extents($v);
} else {
if (is_null($v)) {
$data[$k] = '';
continue;
}
switch ((string) $k) {
case 'file':
$data[$k . '_link'] = getFileUrl($v, 'file');
break;
}
}
}
return $data;
}
/**
* 设置header
* @param $name
* @param $value
* @return
*/
protected function setHeader($name, $value) {
if (is_array($name)) {
$this->header = array_merge($this->header, $name);
} else {
$this->header[$name] = $value;
}
return $this;
}
/**
* post方法请求输出数据
* @param $data
* @return
*/
public function result($list) {
$data['data'] = $list;
$data['page'] = $this->setPages();
$this->response('success', 200, $data);
}
/**
* @name:请求头设置分页返回参数()
* @return
*/
public function setPages() {
$page_count = $this->allCount > $this->row ? ceil($this->allCount / $this->row) : 1;
$this->setHeader('X-Pagination-Total-Count', $this->allCount); //总条数
$this->setHeader('X-Pagination-Page-Count', $page_count); //总页数
$this->setHeader('X-Pagination-Current-Page', $this->p); //当前页数
$this->setHeader('X-Pagination-Per-Page', $this->row); //每页条数
}
/**
* @name:上传文件返回文件名
* @return
*/
public function upload($file_name = ''){
$files = $this->request->file('file');
if(empty($files)){
return $this->response('没有上传文件',202);
}
if(empty($file_name)){
$res = $files->rule('uniqid')->move(ROOT_PATH.'./uploads/');
}else{
$res = $files->rule('uniqid')->move(ROOT_PATH.'./uploads/'.$file_name);
}
if($res === false){
return $this->response($files->getError(),202);
}
$path = $res->getSaveName();
return $path;
}
/**
* @name:上传返回文件详情
*/
public function uploads(){
$files = $this->request->file('file');
if(empty($files)){
return $this->response('没有上传文件',202);
}
if(empty($file_name)){
$res = $files->rule('uniqid')->move(ROOT_PATH.'./uploads/');
}else{
$res = $files->rule('uniqid')->move(ROOT_PATH.'./uploads/'.$file_name);
}
if($res === false){
return $this->response($files->getError(),202);
}
$data['path'] = $res->getSaveName();
$data['size'] = $res->getSize();
return $data;
}
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: asus
* Date: 2019/6/12
* Time: 11:08
*/
namespace app\api\controller;
use think\captcha\Captcha;
use think\Validate;
use app\api\model\Manager as ManagerModel;
class Com extends Base
{
/**
* @name:获取验证码
* @method:get
*/
public function code(){
$this->response('验证码',200,'111');
$config = [
// 验证码字体大小
'fontSize' => 30,
// 验证码位数
'length' => 6,
// 关闭验证码杂点
'useNoise' => false,
];
$captcha = new Captcha($config);
Session::set('captcha',);
$this->response('验证码',200,$captcha->entry());
}
/**
* 管理员登录
* @method:post
* @param $account $password
*/
public function login(){
$rule = [
['account','require|max:15','账号不能为空|最多不能超过25个字符'],
['password','require|max:30','密码不能为空|必须在1~50字符之间'],
];
$validate = new Validate($rule);
if ($validate->check($this->param) === false) {
$this->response($validate->getError(), 202);
}
$manager = new ManagerModel();
$info = $manager->login($this->param['account'],$this->param['password']);
if(empty($info)){
$this->response('账号或者密码错误',202,[]);
}
$this->response('登录成功',200,$info);
}
}
\ No newline at end of file
... ...
<?php
namespace app\api\controller;
use app\admin\controller\Base;
use app\admin\model\Manager as ManagerModel;
use think\Validate;
/**
* @name:管理员管理
*/
class Manager extends Base
{
/**
* @name:获取管理员列表
* @method:get
* @param /p:页数 row:条数
*/
public function lists(){
$managerModel = new ManagerModel();
$lists = $managerModel->lists($this->param,$this->p,$this->row,'sort desc');
$this->allCount = $managerModel->allCount;
$this->result($lists);
}
/**
* @name:添加管理员
* @method:post
* @param:
*/
public function add(){
/*参数验证*/
$rules = [
['username','require|max:25','名称必须|名称最多不能超过25个字符'],
['password','password|between:6,25','密码必须|年龄必须在6~26之间'],
['re_password','require||confirm:password','密码必须|两次密码不一致'],
];
$validate = new Validate($rules);
$res = $validate->check($this->param);
if(!$res){
$this->response($validate->getError(),400,[]);
}
$managerModel = new ManagerModel();
$res = $managerModel->add($this->param);
if($res === false){
$this->response('添加失败',202,[]);
}
$this->response('添加成功',200);
}
/**
* @name : 编辑管理员
* @return void
* @author :liyuhang
* @method
*/
public function edit(){
$rules = [
['id','require','必须'],
];
if(isset($this->param['password']) && !empty($this->param['password'])){
array_push($rules,['password','password|between:6,25','密码必须|年龄必须在6~26之间']);
array_push($rules,['re_password','require||confirm:password','密码必须|两次密码不一致']);
}
$validate = new Validate($rules);
$res = $validate->check($this->param);
if(!$res){
$this->response($validate->getError(),400,[]);
}
$managerModel = new ManagerModel();
if(isset($this->param['password'])){
$this->param['password'] = think_center_md5($this->param['password']);
}
$res = $managerModel->edit($this->param,['id'=>$this->param['id']]);
if($res === false){
$this->response('编辑失败',202,[]);
}
$this->response('编辑成功',200);
}
/**
* @name :修改当前管理员状态
* @return void
* @author :liyuhang
* @method
*/
public function status()
{
/*参数验证*/
$rules = [
['id','require','必须'],
['status','require','必须'],
];
$validate = new Validate($rules);
$res = $validate->check($this->param);
if(!$res){
$this->response($validate->getError(),202,[]);
}
$managerModel = new ManagerModel();
$info = $managerModel->read(['id'=>$this->param['id']]);
if(empty($info)){
$this->response('当前管理员不存在','');
}
$res = $managerModel->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
if ($res === false) {
$this->response('修改状态失败',202,[]);
} else {
$this->response($this->param['status'] == 1 ? '启用成功': '禁用成功',200,[]);
}
}
/**
* @name:排序
* @return void
* @author :liyuhang
* @method
*/
public function sort()
{
/*参数验证*/
$rules = [
['id','require','必须'],
['sort','require','必须'],
];
$validate = new Validate($rules);
$res = $validate->check($this->param);
if(!$res){
$this->response($validate->getError(),202,[]);
}
$res = ManagerModel::where('id', $this->param['id'])->update(['sort' => $this->param['sort']]);
if ($res === false) {
$this->response('排序失败',202,[]);
} else {
$this->response('成功',200,[]);;
}
}
/**
* @name
* @return void
* @author :liyuhang
* @method
*/
public function delete(){
$rules = [
['id','require','必须'],
];
$validate = new Validate($rules);
$res = $validate->check($this->param);
if(!$res){
$this->response($validate->getError(),202,[]);
}
$managerModel = new ManagerModel();
$res = $managerModel->edit(['deleted'=>0],['id'=>$this->param['id']]);
if ($res === false) {
$this->response('排序失败',202,[]);
} else {
$this->response('成功',200,[]);;
}
}
}
\ No newline at end of file
... ...
<?php
/**
* 验证规则
*/
return [
'manager_lists' => [
'allow_method' => 'get',
],
'manager_add' => [
'allow_method' => 'post',
],
'manager_edit' => [
'allow_method' => 'post',
],
'manager_status' => [
'allow_method' => 'get',
],
'com_code' => [
'allow_method' => 'post',
],
];
\ No newline at end of file
... ...
<?php
namespace app\admin\model;
class AdminLog extends Base
{
protected $autoWriteTimestamp = 'datetime';
/**
* @name 一对多
* @return \think\model\relation\HasMany
* @author :liyuhang
* @method
*/
public function manager()
{
return $this->hasMany('manager')->field('username');
}
}
\ No newline at end of file
... ...
<?php
namespace app\admin\model;
use think\Model;
/**
* 模型基类
*/
abstract class Base extends Model
{
public $allCount = 0;
protected $resultSetType = 'collection';
/**
* 列表
* @param $map
* @param $p
* @param $row
* @param string $order
* @param $fields
* @return $lists
*/
public function lists($map, $p, $row, $order = 'id desc', $fields = true)
{
$order || $order = 'id desc';
$lists = $this->field($fields)->where($map)->page($p, $row)->order($order)->select()->toArray();
if (!empty($lists)) {
$this->allCount = $this->where($map)->count();
}
return $lists;
}
/**
* 详情
* @param $data
* @return $info
*/
protected function read($data)
{
$info = $this->where($data)->find();
if (!empty($info)) {
$info = $info->toArray();
}
return $info;
}
/*
* 新增
* @param array $data
* @return bool
*/
public function add($data)
{
return $this->allowField(true)->save($data);
}
/*
* 更新
* @param array $update
* @param array $condition
* @return bool
*/
public function edit($update, $condition)
{
return $this->isUpdate(true)->allowField(true)->save($update, $condition);
}
/*
* 删除
* @param array $condition
* @return bool
*/
public function del($condition)
{
return $this->destroy($condition);
}
}
... ...
<?php
namespace app\admin\model;
class Manager extends Base
{
protected $autoWriteTimestamp = 'datetime';
}
\ No newline at end of file
... ...
<?php
/**
* Created by PhpStorm.
* User: asus
* Date: 2019/3/13
* Time: 10:30
*/
return [
'200'=>'返回成功',
'202'=>'请求失败',
'203'=>'请求方式错误'
];
\ No newline at end of file
... ...
<?php
namespace app\api\controller;
use think\Cache;
use think\Config;
use think\Request;
use think\Response;
use think\Validate;
/**
* 接口基类
* @author liyuhang <523277027@qq.com>
*/
abstract class Base{
protected $method; // 当前请求类型
protected $type; // 当前资源类型
// 输出类型
protected $_btw = [0, 0]; // 时间区间等
protected $url = '';//分享地址
protected $restMethodList = 'post,get';
protected $restDefaultType = '';
protected $header = []; //输出header数据
protected $request = [];
protected $accessToken = '';
protected $p = 1; //分页页数
protected $order = ""; //排序
protected $row = 10; //默认分页数
protected $user = []; //登录对象
protected $uid = 0;
protected $param = []; //post参数
protected $map = [];//post处理过后的参数
protected $allCount = 0; //数据总条数
protected $token = ''; //token
protected $allow_fun = [//登录不需要验证的方法
'com'=>'*',
'user'=>',login,'
];
/**
* 架构函数 取得模板对象实例
* @access public
*/
public function __construct(Request $request) {
session_start();
// 指定允许其他域名访问
$http_origin = "*";
if(isset($_SERVER['HTTP_ORIGIN'])){
$http_origin = $_SERVER['HTTP_ORIGIN'];
}
header("Access-Control-Allow-Origin:".$http_origin);
header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。
if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {
exit;
}
$this->request = $request;
$referer = $this->request->server('referer');
if ($referer && strpos($referer, 'www.*.com') > -1) {
$this->response('系统检测到您的环境存在安全风险,拒绝了您的访问!', 503);
}
// 请求方式检测
$this->method = strtolower($request->method());
$this->param = $this->request->param();
$this->map = $this->request->get();
$this->_getdata();
$this->validate();
$this->authToken();
}
/**
* @name:判断当前状态是否登录
*/
private function authToken() {
$ctr = strtolower($this->request->controller());
$action = strtolower($this->request->action());
if(isset($this->allow_fun[$ctr]) && (($this->allow_fun[$ctr] == '*') || strpos($this->allow_fun[$ctr], sprintf(',%s,', $action)) > -1)){
return;
}
if (isset($this->param['token']) && !empty($this->param['token'])) {
$this->accessToken = $this->param['token'];
} else {
$this->accessToken = $this->request->header('token');
}
if(!Cache::has($this->accessToken)){
$this->response('请登录!', 202,[]);
}
//获取当前的session_id
$cache = Cache::get($this->accessToken);
if(!$cache){ //由于机器人没法登陆,需要跳过登陆验证
$this->response('请登录!', 202,[]);
}
$this->user = $cache;
if($cache){
$this->uid = $this->user['id'];
}
}
/**
* 验证
* @return
*/
private function validate() {
if (false === stripos($this->restMethodList, $this->method)) {
// 请求方式非法 则用默认请求方法
$this->response('请求方式非法', 415, '只允许' . $this->restMethodList);
}
$ctr = strtolower($this->request->controller());
$action = strtolower($this->request->action());
$config = Config::get('validate.'.$ctr.'_'.$action);
if(isset($config) || !empty($config)){
if(false === stripos($config['allow_method'], $this->method)){
$this->response('请求方式错误',415,'只允许'.$config['allow_method']);
}
}
}
/**
* post公共参数初始化
*/
private function _getdata() {
//获取兼容路由参数
$getdata = array_merge($this->request->param(), $this->request->route());
foreach ($getdata as $k => $v) {
if(is_array($v)){
continue;
}
switch ($k) {
case "order":
strpos($v, "-") > -1 ? $v = str_replace("-", " ", $v) : $v = $v . " desc";
$this->order = $v;
break;
case "p":
$this->p = $v;
break;
case "row":
$this->row = $v;
break;
case "name":
$this->map[$k] = ['like','%'.$v.'%'];
break;
case "start":
$this->_btw[0] = $v;
$this->_btw[1] = date('Y-m-d H:i:s',time());
$this->map['created_time'] = ['between', $this->_btw];
break;
case "end":
$this->_btw[1] = $v;
$this->map['created_time'] = ['between', $this->_btw];
break;
case "debug":
defined("DEBUG") || define("DEBUG", $v);
break;
case 'XDEBUG_SESSION_START':
break;
default:
if (!empty($v)) {
$this->map[$k] = $v;
}
break;
}
}
}
/**
* REST 调用
* @access public
* @param string $method 方法名
* @return mixed
* @throws Exception
*/
public function _empty($method) {
$this->response('非法操作=>' . $method, 404);
}
/**
* 通用数据输出
* @param $msg
* @param $code
* @param $data
* @param $result_code
* @param $type
* @return
*/
protected function response($msg, $code = 200, $data = '', $result_code = null, $type = 'json') {
$result_code === null && $result_code = $code;
$result = [
'code' => $result_code,
'msg' => $msg,
'data' => $this->_extents($data),
];
$this->setHeader('X_End_Time', $this->request->time());
$response = Response::create($result, $type)->code($code)->header($this->header);
throw new \think\exception\HttpResponseException($response);
}
/**
* post方法请求输出数据
* @param $data
* @return
*/
protected function result($list) {
$data['data'] = $list;
$data['page'] = $this->setPages();
$this->response('success', 200, $data);
}
protected function _extents($data) {
if (empty($data) || !is_array($data)) {
return empty($data) ? is_array($data) ? [] : '' : $data;
}
foreach ($data as $k => $v) {
if (is_array($v)) {
$data[$k] = $this->_extents($v);
} else {
if (is_null($v)) {
$data[$k] = '';
continue;
}
switch ((string) $k) {
case 'file':
$data[$k . '_link'] = getFileUrl($v, 'file');
break;
}
}
}
return $data;
}
/**
* 设置header
* @param $name
* @param $value
* @return
*/
protected function setHeader($name, $value) {
if (is_array($name)) {
$this->header = array_merge($this->header, $name);
} else {
$this->header[$name] = $value;
}
return $this;
}
/**
* 请求头设置分页返回参数()
*/
public function setPage() {
$page_count = $this->allCount > $this->row ? ceil($this->allCount / $this->row) : 1;
$this->setHeader('X-Pagination-Total-Count', $this->allCount); //总条数
$this->setHeader('X-Pagination-Page-Count', $page_count); //总页数
$this->setHeader('X-Pagination-Current-Page', $this->p); //当前页数
$this->setHeader('X-Pagination-Per-Page', $this->row); //每页条数
}
/**
* 直接返回设置分页返回参数()
*/
protected function setPages() {
$page_count = $this->allCount > $this->row ? ceil($this->allCount / $this->row) : 1;
$this->header['Total-Count'] = $this->allCount; //总条数
$this->header['Page-Count'] = $page_count; //总页数
$this->header['Current-Page'] = $this->p; //当前页数
$this->header['Per-Page'] = $this->row; //每页条数
return $this->header;
}
//敏感词过滤
protected function badword($content) {
$str = str_replace(explode('|', config('sensitive_words')), '***', $content);
return $str;
}
}
... ...
<?php
/**
* Created by PhpStorm.
* User: asus
* Date: 2019/6/12
* Time: 11:08
*/
namespace app\api\controller;
use think\captcha\Captcha;
use think\Validate;
use app\api\model\Manager as ManagerModel;
class Com extends Base
{
/**
* @name:获取验证码
* @method:get
*/
public function code(){
$this->response('验证码',200,'111');
$config = [
// 验证码字体大小
'fontSize' => 30,
// 验证码位数
'length' => 6,
// 关闭验证码杂点
'useNoise' => false,
];
$captcha = new Captcha($config);
$this->response('验证码',200,$captcha->entry());
}
/**
* 管理员登录
* @method:post
* @param $account $password
*/
public function login(){
$rule = [
['account','require|max:15','账号不能为空|最多不能超过25个字符'],
['password','require|max:30','密码不能为空|必须在1~50字符之间'],
];
$validate = new Validate($rule);
if ($validate->check($this->param) === false) {
$this->response($validate->getError(), 202);
}
$manager = new ManagerModel();
$info = $manager->login($this->param['account'],$this->param['password']);
if(empty($info)){
$this->response('账号或者密码错误',202,[]);
}
$this->response('登录成功',200,$info);
}
}
\ No newline at end of file
... ...
<?php
/**
* 验证规则
*/
return [
'com_code' => [
'allow_method' => 'post',
'param' => [
],
],
];
\ No newline at end of file
... ...
<?php
namespace app\api\model;
use think\Model;
/**
* 模型基类
*/
abstract class Base extends Model
{
public $allCount = 0;
protected $resultSetType = 'collection';
/**
* 列表
* @param $map
* @param $p
* @param $row
* @param string $order
* @param $fields
* @return $lists
*/
public function lists($map, $p, $row, $order = 'id desc', $fields = true)
{
$order || $order = 'id desc';
$lists = $this->field($fields)->where($map)->page($p, $row)->order($order)->select()->toArray();
if (!empty($lists)) {
$this->allCount = $this->where($map)->count();
}
return $lists;
}
/**
* 详情
* @param $data
* @return $info
*/
protected function read($data)
{
$info = $this->where($data)->find();
if (!empty($info)) {
$info = $info->toArray();
}
return $info;
}
/*
* 新增
* @param array $data
* @return bool
*/
public function add($data)
{
return $this->allowField(true)->save($data);
}
/*
* 更新
* @param array $update
* @param array $condition
* @return bool
*/
public function edit($update, $condition)
{
return $this->allowField(true)->save($update, $condition);
}
/*
* 删除
* @param array $condition
* @return bool
*/
public function del($condition)
{
return $this->destroy($condition);
}
}
... ...
<?php
/**
* Created by PhpStorm.
* User: asus
* Date: 2019/11/26
* Time: 10:49
*/
namespace app\api\model;
use think\Cache;
class Manager extends Base
{
protected $autoWriteTimestamp = 'datetime';
/**
* 登录 @param $account:账号 $password:密码
*/
public function login($account,$password){
//获取当前用户的账号详情
$info = $this->read(['account'=>$account,'password'=>$password]);
if(empty($info) || $info['status'] == 1){
return [];
}
//更新数据
$token = sha1(uniqid());
$last_login_time = date('Y-m-d H:i:s',time());
$last_ip = request()->ip();
//更新登录时间与登录ip
$rs = $this->edit(['token'=>$token,'update_time'=>$last_login_time,'last_ip'=>$last_ip],['id'=>$info['id']]);
if($rs === false){
return [];
}
//清空上一次缓存,实现单点登录
Cache::rm($info['token']);
//更新
$info['token'] = $token;
$info['update_time'] = $last_login_time;
$info['last_ip'] = $last_ip;
//过滤密码
unset($info['password']);
//生成缓存
$expire = 3600 * 24 * 7;
Cache::set($token, $info, $expire);
return $info;
}
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [];
... ...
<?php
use OSS\OssClient; // | OSS客户端类,用户通过OssClient的实例调用接口 |
use OSS\Core\OssException; // | OSS异常类,用户在使用的过程中,只需要注意这个异常|
// 应用公共文件
define('MANAGER_AUTH_KEY', 'k]J$[8b)%0Fv=lmecB3qI|D4@#LdC`xOaN6-{QWZ'); //加密KEY
//获取毫秒
function getMillisecond()
{
list($t1, $t2) = explode(' ', microtime());
return (float) sprintf('%.0f', (floatval($t1) + floatval($t2)) * 1000);
}
function microtime_format($tag, $time)
{
$a = substr($time, 0, 10);
$b = substr($time, 10);
$date = date($tag, $a) . '-' . $b;
return $date;
}
/**
* 获取文件后缀名,并判断是否合法
*
* @param string $file_name
* @param array $allow_type
* @return blob
*/
function get_file_suffix($file_name, $allow_type = array())
{
$fnarray=explode('.', $file_name);
$file_suffix = strtolower(array_pop($fnarray));
if (empty($allow_type)) {
return $file_suffix;
} else {
if (in_array($file_suffix, $allow_type)) {
return true;
} else {
return false;
}
}
}
/**
* 远程文件下载
* @param $file_url
* @param $filePath 保存路径
*/
function downfile($file_url, $filePath)
{
$header[] = "content-type: application/x-www-form-urlencoded;
charset = UTF-8";
$ch1 = curl_init();
$timeout = 60;
curl_setopt($ch1, CURLOPT_URL, $file_url);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, false);
$content = curl_exec($ch1);
curl_close($ch1);
// $content = file_get_contents($file_url);
if (file_put_contents($filePath, $content)) {
return true;
} else {
return false;
}
}
//手机验证格式
function check_mobile($mobile_phone)
{
$mobile_phone = trim($mobile_phone);
if (preg_match("/^1[3-9]{1}[0-9]{9}$/", $mobile_phone)) {
return $mobile_phone;
} else {
return false;
}
}
//验证邮箱格式
function checke_mail($email)
{
$pattern = "/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/"; //[ch]定义验证email正则表达式
if (preg_match($pattern, $email, $counts)) {
return true;
} else {
return false;
}
}
/**
* 取得文件扩展
*
* @param $filename
* @return
*/
function fileext($filename)
{
return strtolower(trim(substr(strrchr($filename, '.'), 1, 10)));
}
/**
* IE浏览器判断
*/
function is_ie()
{
$useragent = strtolower($_SERVER['HTTP_USER_AGENT']);
if ((strpos($useragent, 'opera') !== false) || (strpos($useragent, 'konqueror') !== false)) {
return false;
}
if (strpos($useragent, 'msie ') !== false) {
return true;
}
return false;
}
/**
* 创建目录
* @param string $path 要创建的目录
* @return boolean 创建状态,true-成功,false-失败
*/
function mkdirs($path, $mode = 0755)
{
if (!is_dir(dirname($path))) {
mkdirs(dirname($path), $mode);
}
if (!file_exists($path)) {
return @mkdir($path, $mode);
}
}
/**
* 压缩音频文件
* @param string $file 需要压缩的文件路径
* @param string $path 压缩后的文件路径
* @return boolean
*/
function ffmpeg($file, $path)
{
$rest = shell_exec("(ffmpeg -i " . $file . " -vn -c:a libmp3lame -b:a 128k -ac 2 " . $path . " >/dev/null & ) ");
return true;
}
/**
* 系统非常规MD5加密方法
* @param string $str 要加密的字符串
* @return string
*/
function think_center_md5($str, $key = '')
{
return '' === $str ? '' : md5(sha1($str) . $key);
}
//apk文件路径生成hash值
function file_hash($path){
$cmd = '-tfile_sha -s'.base64_encode($path);
$hash = call($cmd);
return $hash;
}
function call($icbp_info){
if($icbp_info==""){
\think\Log::write('info', '执行的hst_icbp命令:命令没有参数 --line:'.__LINE__);
return false;
exit;
}
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w") // stderr
);
$cmd = '/home/alg_icbp/hst_icbp '.$icbp_info; // 替换为你要执行的shell脚本
\think\Log::write('info', '执行的cmd命令:'.print_r($cmd,true).'--line:'.__LINE__);
$proc = proc_open($cmd, $descriptorspec, $pipes, null, null);
// $proc为false,表明命令执行失败
if ($proc == false) {
// do sth with HTTP response
} else {
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$status = proc_close($proc); // 释放proc
}
$data = array(
'code' => 0,
'msg' => array(
'stdout' => $stdout,
'stderr' => $stderr,
'retval' => $status
)
);
\think\Log::write('info', '执行的CMD命令结果:'.print_r($data['msg']['stdout'],true).'--line:'.__LINE__);
return $data['msg']['stdout'];
}
/**
* 系统加密方法
* @param string $data 要加密的字符串
* @param string $key 加密密钥
* @param int $expire 过期时间 单位 秒
* @return string
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
function think_encrypt($data, $key, $expire = 0)
{
$key = md5($key);
$data = base64_encode($data);
$x = 0;
$len = strlen($data);
$l = strlen($key);
$char = '';
for ($i = 0; $i < $len; $i++) {
if ($x == $l) {
$x = 0;
}
$char .= substr($key, $x, 1);
$x++;
}
$str = sprintf('%010d', $expire ? $expire + time() : 0);
for ($i = 0; $i < $len; $i++) {
$str .= chr(ord(substr($data, $i, 1)) + (ord(substr($char, $i, 1))) % 256);
}
return str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode($str));
}
/**
* 系统解密方法
* @param string $data 要解密的字符串 (必须是think_encrypt方法加密的字符串)
* @param string $key 加密密钥
* @return string
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
function think_decrypt($data, $key)
{
$key = md5($key);
$data = str_replace(array('-', '_'), array('+', '/'), $data);
$mod4 = strlen($data) % 4;
if ($mod4) {
$data .= substr('====', $mod4);
}
$data = base64_decode($data);
$expire = substr($data, 0, 10);
$data = substr($data, 10);
if ($expire > 0 && $expire < time()) {
return '';
}
$x = 0;
$len = strlen($data);
$l = strlen($key);
$char = $str = '';
for ($i = 0; $i < $len; $i++) {
if ($x == $l) {
$x = 0;
}
$char .= substr($key, $x, 1);
$x++;
}
for ($i = 0; $i < $len; $i++) {
if (ord(substr($data, $i, 1)) < ord(substr($char, $i, 1))) {
$str .= chr((ord(substr($data, $i, 1)) + 256) - ord(substr($char, $i, 1)));
} else {
$str .= chr(ord(substr($data, $i, 1)) - ord(substr($char, $i, 1)));
}
}
return base64_decode($str);
}
/**
* 判断字符串是否以指定字符开头
* @param $str '字符串'
* @param $needle '指定字符'
* @return
*/
function startWith($str, $needle)
{
return strpos($str, $needle) === 0;
}
/**
*
* @return int
*/
function is_login()
{
//判断当前用户是否还存在
$token = session('user_auth');
$user = \think\Cache::get($token);
//TODO::版本号
if (empty($user)) {
return '';
} else {
return $user;
}
}
function getMemberRoleToString($role, $field = 'nickname')
{
$lists = app\admin\model\Manager::where('role', $role)->column('nickname');
return implode(',', $lists);
}
/**
* 判断是否是超级管理员
* @param $uid
* @return
*/
function is_administrator($uid = null)
{
return $uid && (intval($uid) === \think\Config::get('is_administrator_id')) ? 1 : 0;
}
/**
* 获取菜单树(html)
* @param $pid
* @param $id
* @param $table
* @return
*/
function getTree($pid = 0, $id = 0, $ispid = false)
{
$auth = new \app\admin\model\AuthRule();
$map = ['id' => ['neq', $id]];
$ispid && $map['pid'] = 0;
// $map['type'] = ['lt', 3];
$menu = $auth->where($map)->field('id,title,pid')->select()->toArray();
$tree = " <option value=\"0\">顶级菜单</option>";
foreach ($menu as $k => $v) {
if ($v['pid'] == 0) {
if ($ispid) {
$tree .= "<option value=\"" . $v['id'] . "\" ";
if ($v['id'] == $pid) {
$tree .= "selected=\"selected\"";
}
$tree .= " >" . $v['title'] . "</option>";
continue;
}
$cate_prent = new \tree\Tree($menu);
$tree .= "<option value=\"" . $v['id'] . "\" ";
if ($v['id'] == $pid) {
$tree .= "selected=\"selected\"";
}
$tree .= " >" . $v['title'] . "</option>";
$tree .= $cate_prent->get_tree($v['id'], "<option value=\$id \$selected>\$spacer\$title</option>", $pid);
}
}
return $tree;
}
/**
* 生成图片文件地址
* @param type $sha1 sha1
* @param type $type image
* @return type
*/
function getFileUrl($sha1, $type = 'image')
{
$url = '';
switch ($type) {
case 'image':
if (strpos($sha1, "http://") !== false) {
$url = $sha1;
} else {
$url = $sha1 ? url('/image/' . $sha1, '', '', true) : '';
}
break;
case 'images':
break;
case 'file':
$url = $sha1 ? url('/file/' . $sha1, '', '',true) : '';
break;
}
return $url;
}
/**
* 发送http post请求
* @param type $url
* @param type $post_data
*/
function http_post($url, $post_data)
{
$header[] = "charset = UTF-8";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
if (curl_errno($ch)) {
\think\Log::write(print_r(curl_errno($ch),1),'debug---1');
}
curl_close($ch);
return json_decode($res, true);
}
/**
* 发送http get请求
* @param type $url
* @return type
*/
function http_get($url)
{
$header[] = "content-type: application/x-www-form-urlencoded;
charset = UTF-8";
$ch1 = curl_init();
$timeout = 5;
curl_setopt($ch1, CURLOPT_URL, $url);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch1, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch1, CURLOPT_SSL_VERIFYHOST, false);
$accesstxt = curl_exec($ch1);
curl_close($ch1);
return json_decode($accesstxt, true);
}
/**
* 正则验证手机号
* @param $tel 11位手机号
* @return bool
*/
function is_mobile($tel)
{
if (!preg_match("/^1[3,6,5,8,7][0-9]{9}$/", $tel)) {
return false;
}
return true;
}
/**
* 生成随机字符串
* @param int $length 要生成的随机字符串长度
* @param string $type 随机码类型:0 数字+大小写字母 1 数字 2 小写字母 3 大写字母 4 特殊字符 -1 数字+大小写字母+特殊字符
* @return string
*/
function randCode($length = 5, $type = 0)
{
$arr = array(1 => "0123456789", 2 => "abcdefghijklmnopqrstuvwxyz", 3 => "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 4 => "~@#$%^&*(){}[]|");
if ($type == 0) {
array_pop($arr);
$string = implode("", $arr);
} elseif ($type == "-1") {
$string = implode("", $arr);
} else {
$string = $arr[$type];
}
$count = strlen($string) - 1;
$code = '';
for ($i = 0; $i < $length; $i++) {
$code .= $string[rand(0, $count)];
}
return $code;
}
/**
* 随机取数组N个元素
*
* @param array $arr 原数组
* @param int $num 个数
* @return array
*/
function array_random($arr = [], $num = 1)
{
shuffle($arr);
$r = [];
$num = $num > count($arr) ? count($arr) : $num;
for ($i = 0; $i < $num; $i++) {
$r[] = $arr[$i];
}
return 1 == $num ? $r[0] : $r;
}
/**
*
* @param type $len 邀请码长度
* @return varchar $string 字符串
* /
*/
function rand_code($len)
{
$chars = '0123456789abcdefghijklmnopqrstuvwxyz';
$string = substr(time(), -4);
for (; $len >= 1; $len--) {
$position = rand() % strlen($chars);
$position2 = rand() % strlen($string);
$string = substr_replace($string, substr($chars, $position, 1), $position2, 0);
}
return $string;
}
/**
* 截取字符串
*/
function substrs($str){
//去除标签
$str = strip_tags($str);
return substr($str,0,50);
}
/***
* 写入日志
* @param operator:操作人
* @param remark:详情
*/
function set_log($data){
$log = new \app\admin\model\YLog();
return $log->add($data);
}
/***
*使用mq发送消息
*/
function set_mq_msg($rout_key,$msg){
$str = '/home/anmi/amqp_sendstring 127.0.0.1 5672 amq.topic ctrl 123';
shell_exec($str);
return;
}
//验证ip是否合法
function isOk_ip($ip){
if(preg_match('/^((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1 -9]?\d))))$/', $ip)) {
return 1;
}else{
return 0;
}
}
/**
* @name:修改ini文件参数
* @param $key
* @param $value
* @param $filename//文件路径
*/
function system_config($key,$value,$filename){
$str = "sed -i 's/".$key."=.*/".$key."=".$value."/g' ".$filename;
calls($str);
}
//读取ini文件
function set_ini_file($file_name){
if(!is_file($file_name)){
$this->error('当前文件不存在','');
}
return parse_ini_file($file_name);
}
//读取非ini文件
function get_sip_id($file_name){
$list = file_get_contents($file_name);
$list = str_replace(array("\r\n", "\r", "\n"), ',', $list);
$list = trim($list,',');
$list = explode(',',$list);
$arr = '';
foreach ($list as $v){
if(strpos($v,'SIP_ID') !== false){
$arr = str_replace('SIP_ID=','',$v);
break;
}
}
return $arr;
}
//发送sip消息到资源服务器
function send_msg($data){
//ycx 修改 20190809 如果配置文件中设置了内网IP就使用内网
$sip_to_server = config('sip_to_server');
if(config('sip_to_server_inner')){
$sip_to_server = config('sip_to_server_inner');
}
\think\Log::write(print_r(config('sip')." miscapps send_message '".config('sip_to_account')."' '".config('sip_to_resource_account')."' '"
.base64_encode(json_encode($data)). "' '".config('sip_to_resource_account')."' '".$sip_to_server."' ''",1),'debug');
shell_exec(config('sip')." miscapps send_message '".config('sip_to_account')."' '".config('sip_to_resource_account')."' '"
.base64_encode(json_encode($data)). "' '".config('sip_to_resource_account')."' '".$sip_to_server."' ''");
}
//发送sip消息通知客户端
function send_app_msg($data,$sip){
$sip_to_server = config('sip_to_server');
// if(config('sip_to_server_inner')){
// $sip_to_server = config('sip_to_server_inner');
//}
\think\Log::write(print_r(config('sip')." miscapps send_message '".config('sip_to_account')."' '".$sip."' '"
.base64_encode(json_encode($data)). "' '".$sip."' '".$sip_to_server."' ''",1),'debug');
shell_exec(config('sip')." miscapps send_message '".config('sip_to_account')."' '".$sip."' '"
.base64_encode(json_encode($data)). "' '".$sip."' '".$sip_to_server."' ''");
}
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// +----------------------------------------------------------------------
// | 应用设置
// +----------------------------------------------------------------------
// 应用命名空间
'app_namespace' => 'app',
// 应用调试模式
'app_debug' => true,
// 应用Trace
'app_trace' => false,
// 应用模式状态
'app_status' => '',
// 是否支持多模块
'app_multi_module' => true,
// 入口自动绑定模块
'auto_bind_module' => false,
// 注册的根命名空间
'root_namespace' => [],
// 扩展函数文件
'extra_file_list' => [THINK_PATH . 'helper' . EXT],
// 默认输出类型
'default_return_type' => 'html',
// 默认AJAX 数据返回格式,可选json xml ...
'default_ajax_return' => 'json',
// 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法
'var_jsonp_handler' => 'callback',
// 默认时区
'default_timezone' => 'PRC',
// 是否开启多语言
'lang_switch_on' => false,
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => '',
// 默认语言
'default_lang' => 'zh-cn',
// 应用类库后缀
'class_suffix' => false,
// 控制器类后缀
'controller_suffix' => false,
// +----------------------------------------------------------------------
// | 模块设置
// +----------------------------------------------------------------------
// 默认模块名
'default_module' => 'index',
// 禁止访问模块
'deny_module_list' => ['common'],
// 默认控制器名
'default_controller' => 'Index',
// 默认操作名
'default_action' => 'index',
// 默认验证器
'default_validate' => '',
// 默认的空控制器名
'empty_controller' => 'Error',
// 操作方法后缀
'action_suffix' => '',
// 自动搜索控制器
'controller_auto_search' => false,
// +----------------------------------------------------------------------
// | URL设置
// +----------------------------------------------------------------------
// PATHINFO变量名 用于兼容模式
'var_pathinfo' => 's',
// 兼容PATH_INFO获取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// pathinfo分隔符
'pathinfo_depr' => '/',
// URL伪静态后缀
'url_html_suffix' => 'html',
// URL普通方式参数 用于自动生成
'url_common_param' => false,
// URL参数方式 0 按名称成对解析 1 按顺序解析
'url_param_type' => 0,
// 是否开启路由
'url_route_on' => true,
// 路由使用完整匹配
'route_complete_match' => false,
// 路由配置文件(支持配置多个)
'route_config_file' => ['route'],
// 是否强制使用路由
'url_route_must' => false,
// 域名部署
'url_domain_deploy' => false,
// 域名根,如thinkphp.cn
'url_domain_root' => '',
// 是否自动转换URL中的控制器和操作名
'url_convert' => true,
// 默认的访问控制器层
'url_controller_layer' => 'controller',
// 表单请求类型伪装变量
'var_method' => '_method',
// 表单ajax伪装变量
'var_ajax' => '_ajax',
// 表单pjax伪装变量
'var_pjax' => '_pjax',
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
'request_cache' => false,
// 请求缓存有效期
'request_cache_expire' => null,
// +----------------------------------------------------------------------
// | 模板设置
// +----------------------------------------------------------------------
'template' => [
// 模板引擎类型 支持 php think 支持扩展
'type' => 'Think',
// 模板路径
'view_path' => '',
// 模板后缀
'view_suffix' => 'html',
// 模板文件名分隔符
'view_depr' => DS,
// 模板引擎普通标签开始标记
'tpl_begin' => '{',
// 模板引擎普通标签结束标记
'tpl_end' => '}',
// 标签库标签开始标记
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
],
// 视图输出字符串内容替换
'view_replace_str' => [],
// 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
// +----------------------------------------------------------------------
// | 异常及错误设置
// +----------------------------------------------------------------------
// 异常页面的模板文件
'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
// 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~',
// 显示错误信息
'show_error_msg' => false,
// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle' => '',
// +----------------------------------------------------------------------
// | 日志设置
// +----------------------------------------------------------------------
'log' => [
// 日志记录方式,内置 file socket 支持扩展
'type' => 'File',
// 日志保存目录
'path' => LOG_PATH,
// 日志记录级别
'level' => [],
],
// +----------------------------------------------------------------------
// | Trace设置 开启 app_trace 后 有效
// +----------------------------------------------------------------------
'trace' => [
// 内置Html Console 支持扩展
'type' => 'Html',
],
// +----------------------------------------------------------------------
// | 缓存设置
// +----------------------------------------------------------------------
'cache' => [
// 驱动方式
'type' => 'File',
// 缓存保存目录
'path' => CACHE_PATH,
// 缓存前缀
'prefix' => '',
// 缓存有效期 0表示永久缓存
'expire' => 0,
],
// +----------------------------------------------------------------------
// | 会话设置
// +----------------------------------------------------------------------
'session' => [
'id' => '',
// SESSION_ID的提交变量,解决flash上传跨域
'var_session_id' => '',
// SESSION 前缀
'prefix' => 'think',
// 驱动方式 支持redis memcache memcached
'type' => '',
// 是否自动开启 SESSION
'auto_start' => true,
],
// +----------------------------------------------------------------------
// | Cookie设置
// +----------------------------------------------------------------------
'cookie' => [
// cookie 名称前缀
'prefix' => '',
// cookie 保存时间
'expire' => 0,
// cookie 保存路径
'path' => '/',
// cookie 有效域名
'domain' => '',
// cookie 启用安全传输
'secure' => false,
// httponly设置
'httponly' => '',
// 是否使用 setcookie
'setcookie' => true,
],
//分页配置
'paginate' => [
'type' => 'bootstrap',
'var_page' => 'page',
'list_rows' => 15,
],
];
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => '127.0.0.1',
// 数据库名
'database' => 'tp',
// 用户名
'username' => 'root',
// 密码
'password' => '123456',
// 端口
'hostport' => '3306',
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 'tp_',
// 数据库调试模式
'debug' => true,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => true,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => true,
// 时间字段取出后的默认时间格式
'datetime_format' => 'Y-m-d H:i:s',
// 是否需要进行SQL性能分析
'sql_explain' => false,
// Builder类
'builder' => '',
// Query类
'query' => '\\think\\db\\Query',
];
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
return [
'connector' => 'Sync'
];
\ No newline at end of file
... ...
<?php
/**
* 验证规则
*/
return [
'com_code' => [
'allow_method' => 'post',
],
];
\ No newline at end of file
... ...
<?php
return [
/**
* 图片上传配置
*/
'upload_img' => [
//验证
'rule' => [
'size' => 3 * 1024 * 1024, //大小限制
'ext' => 'jpeg,jpg,png,gif', //文件类型限制
],
//生成文件规则
'savename' => 'uniqid',
//缩略图缓存路径(可删除)
'cache' => ROOT_PATH . 'runtime/images/',
//设置静态缓存参数(304)
'header_cache' => [
'Cache-Control' => 'max-age=2592000',
'Pragma' => 'cache',
'Expires' => "%Expires%", // cache 1 month
'etag' => "%etag%",
'Last-Modified' => "%Last-Modified%",
'Content-Description' => 'File Transfer',
],
//图片保存根路径
'path' => './uploads/images/',
//图片上传变量名
'name' => 'image',
],
/**
* 文件上传配置
*/
'upload_file' => [
//验证
'rule' => [
'size' => 50 * 1024 * 1024, //大小限制
],
'cache' => ROOT_PATH . 'runtime/file/',
//生成文件规则
'savename' => 'uniqid',
'header_cache' => [
'Accept-Ranges' => 'bytes',
'Cache-Control' => 'public',
'Pragma' => 'cache',
'Expires' => "%Expires%", // cache 1 month
'etag' => "%etag%",
'Last-Modified' => "%Last-Modified%",
],
//文件保存根路径
'path' => './uploads/files/',
//文件上传变量名
'name' => 'file',
//压缩文件临时保存根路径
'temp_path' => ROOT_PATH . 'runtime/file/',
//mime限制
// 'mime_type' => ['video/x-ms-asf', 'application/octet-stream', 'audio/mp4', 'audio/x-flac', 'audio/mpeg', 'audio/x-wav'],
],
/**
* 文件上传配置
*/
'upload_audio' => [
//验证
'rule' => [
'size' => 50 * 1024 * 1024, //大小限制
],
'cache' => ROOT_PATH . 'runtime/file/',
//生成文件规则
'savename' => 'uniqid',
'header_cache' => [
'Accept-Ranges' => 'bytes',
'Cache-Control' => 'public',
'Pragma' => 'cache',
'Expires' => "%Expires%", // cache 1 month
'etag' => "%etag%",
'Last-Modified' => "%Last-Modified%",
],
//文件保存根路径
'path' => './uploads/files/',
//文件上传变量名
'name' => 'file',
//压缩文件临时保存根路径
'temp_path' => ROOT_PATH . 'runtime/file/',
],
];
... ...
<?php
namespace app\files\controller;
use think\Request;
use think\Response;
/**
* 通用文件处理
*/
class File
{
protected $request;
protected $config;
public function __construct(Request $request)
{
$this->request = $request;
$this->config = config('upload_file');
}
/**
* 输出返回数据
* @access protected
* @param mixed $data 要返回的数据
* @param String $type 返回类型 JSON XML
* @param integer $code HTTP状态码
* @return Response
*/
protected function response($msg, $code = 200, $data = '', $type = 'json')
{
$result = [
'code' => $code,
'msg' => $msg,
'data' => $data,
'_link' => '',
];
if ($data) {
if (is_array($data)) {
foreach ($data as $key => $value) {
$result['_link'][] = getFileUrl($value, 'file');
}
} else {
$result['_link'] = getFileUrl($data, 'file');
}
}
$header = ['x_end_time' => $this->request->time()];
return Response::create($result, $type)->code($code)->header($header);
}
/**
* 文件上传
*/
public function upload() {
$files = $this->request->file($this->config['name']);
if (empty($files)) {
return $this->response('没有上传的文件!', 400);
}
$type = $this->request->param('type', 'single');
if ($type == 'multi') {
return $this->multi($files);
} else {
return $this->single($files);
}
}
/**
* 文件下载
*
* @return \think\Response
*/
public function index($sha1, $type = 128) {
$info = db('file')->where('sha1', $sha1)->find();
if (empty($info)) {
return $this->response('指定文件不存在!', 404);
}
$path = '../../' . $info['path'];
if (!is_file($path)) {
return $this->response('指定文件已被系统删除!', 404);
}
$content = file_get_contents($path);
$header['Content-Length'] = $info['size'];
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
//for IE
$header['Content-Disposition'] = 'attachment; filename="' . rawurlencode(time() . '.' . $info['ext']) . '"';
} else {
$header['Content-Disposition'] = 'attachment; filename="' . time() . '.' . $info['ext'] . '"';
}
return response($content, 200, $header);
}
/**
* 单文件上传
* @param type $file file对象
* @return type
*/
private function single($file) {
if (is_array($file)) {
$file = current($file);
}
if ($file->check($this->config['rule']) === false) {
return $this->response($file->getMime() . $file->getError() . $this->config['rule']['type'], 400);
}
$info = db('file')->where('sha1', $file->hash())->find();
if (empty($info)) {
$res = $file->rule($this->config['savename'])->move(ROOT_PATH . $this->config['path']);
if ($res === false) {
return $this->response($file->getError(), 400);
}
$info = [
'path' => $this->config['path'] . $res->getSaveName(),
'create_time' => $this->request->time(),
'sha1' => $res->hash(),
'size' => $res->getSize(),
'ext' => $res->getExtension(),
];
db('file')->insert($info);
}
return $this->response('上传成功!', 200, $file->hash());
}
/**
* 多文件上传
* @param type $files file对象集合
* @return type
*/
private function multi($files) {
if (!is_array($files)) {
$files = [$files];
}
$savedata = [];
$data = [];
foreach ($files as $file) {
if ($file->check($this->config['rule']) === false) {
return $this->response($file->getError(), 400);
}
$info = db('picture')->where('sha1', $file->hash())->find();
if (empty($info)) {
$res = $file->rule($this->config['savename'])->move(ROOT_PATH . $this->config['path']);
if ($res === false) {
return $this->response($file->getError(), 400);
}
$savedata[] = [
'path' => $this->config['path'] . $res->getSaveName(),
'create_time' => $this->request->time(),
'sha1' => $res->hash(),
'size' => $res->getSize(),
'mime' => $res->getMime(),
'ext' => $res->getExtension(),
];
}
$data[] = $file->hash();
}
if (!empty($savedata)) {
db('file')->insertAll($savedata);
}
return $this->response('上传成功!', 200, $data);
}
}
... ...
<?php
namespace app\files\controller;
use think\Request;
use think\Response;
use think\Cache;
/**
* 通用图片处理
*/
class Image {
protected $request;
protected $config;
/**
* 缓存前缀
*/
const PREFIX = '_image_';
const EXPIRE = 2592000;
public function __construct(Request $request) {
$this->request = $request;
$this->config = config('upload_img');
}
/**
* 输出返回数据
* @access protected
* @param mixed $data 要返回的数据
* @param String $type 返回类型 JSON XML
* @param integer $code HTTP状态码
* @return Response
*/
protected function response($msg, $code = 200, $data = '', $type = 'json') {
$result = [
'code' => $code,
'msg' => $msg,
'data' => $data,
'_link' => '',
];
if ($data) {
if (is_array($data)) {
foreach ($data as $key => $value) {
$result['_link'][] = getFileUrl($value);
}
} else {
$result['_link'] = getFileUrl($data);
}
}
$header = ['x_end_time' => $this->request->time()];
$response = Response::create($result, $type)->code($code)->header($header);
throw new \think\exception\HttpResponseException($response);
}
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index($sha1, $w = 0, $h = 0, $type = 3) {
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
header("HTTP/1.1 304 Not Modified");
exit;
}
$info = Cache::get(self::PREFIX . $sha1);
if (empty($info)) {
$info = db('picture')->where('sha1', $sha1)->find();
if (empty($info)) {
return $this->response('指定图片不存在!', 404);
}
Cache::set(self::PREFIX . $sha1, $info, self::EXPIRE);
}
$path = '../../' . $info['path'];
if (!is_file($path)) {
// db('picture')->delete($info['id']);
return $this->response('指定图片已被系统删除!', 404,$path);
}
$content = '';
$last_modified_time = gmdate(time() + ((30 * 60 * 60 * 24))) . " GMT";
$header = str_replace(['%Expires%', "%etag%", '%Last-Modified%'], [$last_modified_time, $sha1 . ':' . $w . '_' . $h . '_' . $type, $last_modified_time], $this->config['header_cache']);
if ($w > 0 && $h > 0) {
$path = $this->cacheImage($info, $w, $h, $type);
$content = file_get_contents($path);
$header['Content-Length'] = strlen($content);
} else {
$content = file_get_contents($path);
$header['Content-Length'] = $info['size'];
}
return response($content, 200, $header);
}
/**
* 生成缩略图缓存
* @param type $info
* @param type $w
* @param type $h
* @return string
*/
private function cacheImage($info, $w, $h, $type = 1) {
$cache = $this->config['cache'] . substr($info['sha1'], 0, 2) . DS . substr($info['sha1'], 2) . DS;
$filename = $cache . $w . '_' . $h . '_' . $type;
$this->_mkdir($cache);
if (is_file($filename)) {
return $filename;
}
$img = \think\Image::open('./.' . $info['path']);
$img->thumb($w, $h, $type)->save($filename);
return $filename;
}
/**
* 创建目录
* @param string $savepath 要创建的穆里
* @return boolean 创建状态,true-成功,false-失败
*/
private function _mkdir($path) {
if (is_dir($path)) {
return true;
}
if (mkdir($path, 0755, true)) {
return true;
} else {
return false;
}
}
/**
* 图片上传
*/
public function upload() {
$files = $this->request->file($this->config['name']);
if (empty($files)) {
$this->response('没有上传的文件!', 400);
}
$type = $this->request->param('type', 'single');
if ($type == 'multi') {
return $this->multi($files);
} else {
return $this->single($files);
}
}
/**
* 单图片上传
* @param type $file file对象
* @return type
*/
private function single($file) {
if (is_array($file)) {
$file = current($file);
}
if ($file->check($this->config['rule']) === false) {
return $this->response($file->getError(), 400);
}
$info = db('picture')->where('sha1', $file->hash())->find();
if (empty($info) || !is_file('./.' . $info['path'])) {
if (isset($info['path']) && !is_file('./.' . $info['path'])) {
db('picture')->delete($info['id']);
}
$res = $file->rule($this->config['savename'])->move(ROOT_PATH . $this->config['path']);
if ($res === false) {
return $this->response($file->getError(), 400);
}
$data = [
'path' => $this->config['path'] . $res->getSaveName(),
'create_time' => $this->request->time(),
'sha1' => $res->hash(),
'size' => $res->getSize(),
];
if (isset($info['id'])) {
$data['id'] = $info['id'];
db('picture')->update($data);
Cache::set(self::PREFIX . $data['sha1'], $info, self::EXPIRE);
} else {
db('picture')->insert($data);
}
}
$this->response('上传成功!', 200, $file->hash());
}
/**
* 多图片上传
* @param type $files file对象集合
* @return type
*/
private function multi($files) {
if (!is_array($files)) {
$files = [$files];
}
$savedata = [];
$data = [];
foreach ($files as $file) {
if ($file->check($this->config['rule']) === false) {
return $this->response($file->getError(), 400);
}
$info = db('picture')->where('sha1', $file->hash())->find();
if (empty($info) || !is_file('./.' . $info['path'])) {
if (isset($info['path']) && !is_file('./.' . $info['path'])) {
db('picture')->delete($info['id']);
}
$res = $file->rule($this->config['savename'])->move(ROOT_PATH . $this->config['path']);
if ($res === false) {
return $this->response($file->getError(), 400);
}
$savedata[] = [
'path' => $this->config['path'] . $res->getSaveName(),
'create_time' => $this->request->time(),
'sha1' => $res->hash(),
'size' => $res->getSize(),
];
}
$data[] = $file->hash();
}
if (!empty($savedata)) {
db('picture')->insertAll($savedata);
}
$this->response('上传成功!', 200, $data);
}
}
... ...
<?php
namespace app\index\controller;
class Index
{
public function index()
{
return '<style type="text/css">*{ padding: 0; margin: 0; } .think_default_text{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p> ThinkPHP V5<br/><span style="font-size:30px">十年磨一剑 - 为API开发设计的高性能框架</span></p><span style="font-size:22px;">[ V5.0 版本由 <a href="http://www.qiniu.com" target="qiniu">七牛云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_bd568ce7058a1091"></thinkad>';
}
}
... ...
<?php
use think\Route;
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
/**
* 图片路由
*/
Route::get('image/:sha1', 'files/image/index', [], ['w' => '\d+', 'h' => '\d+', 'type' => '\d+']);
/**
* 文件路由
*/
Route::get('file/:sha1', 'files/file/index');
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
return [
// 应用初始化
'app_init' => [],
// 应用开始
'app_begin' => [],
// 模块初始化
'module_init' => [],
// 操作开始执行
'action_begin' => [],
// 视图内容过滤
'view_filter' => [],
// 日志写入
'log_write' => [],
// 应用结束
'app_end' => [],
];
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
return [
// 生成应用公共文件
'__file__' => ['common.php', 'config.php', 'database.php'],
// 定义demo模块的自动生成 (按照实际定义的文件名生成)
'demo' => [
'__file__' => ['common.php'],
'__dir__' => ['behavior', 'controller', 'model', 'view'],
'controller' => ['Index', 'Test', 'UserType'],
'model' => ['User', 'UserType'],
'view' => ['index/index'],
],
// 其他更多的模块定义
];
... ...
{
"name": "topthink/think",
"description": "the new thinkphp framework",
"type": "project",
"keywords": [
"framework",
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
},
"require": {
"php": ">=5.4.0",
"topthink/framework": "^5.0",
"topthink/think-image": "^1.0",
"topthink/think-captcha": "^1.0",
"topthink/think-mongo": "^1.0",
"topthink/think-migration": "^1.0",
"topthink/think-angular": "^1.0",
"topthink/think-sae": "^1.0",
"topthink/think-worker": "^1.0",
"topthink/think-queue": "^1.0",
"topthink/think-testing": "^1.0"
},
"extra": {
"think-path": "thinkphp"
},
"config": {
"preferred-install": "dist"
}
}
... ...
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "6b9a74290d1ce77641321c846475ab00",
"content-hash": "09c3d6cb820b0f7e546b8d5395b3e723",
"packages": [
{
"name": "doctrine/instantiator",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/doctrine/instantiator/8e884e78f9f0eb1329e445619e04456e64d8051d.zip",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "http://ocramius.github.com/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://github.com/doctrine/instantiator",
"keywords": [
"constructor",
"instantiate"
],
"time": "2015-06-14 21:17:01"
},
{
"name": "phpdocumentor/reflection-common",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/phpDocumentor/ReflectionCommon/144c307535e82c8fdcaacbcfc1d6d8eeb896687c.zip",
"reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2015-12-27 11:43:31"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/phpDocumentor/ReflectionDocBlock/8331b5efe816ae05461b7ca1e721c01b46bafb3e.zip",
"reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.2.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2016-09-30 07:12:33"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.2.1",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/phpDocumentor/TypeResolver/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb.zip",
"reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2016-11-25 06:54:22"
},
{
"name": "phpspec/prophecy",
"version": "v1.6.2",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/phpspec/prophecy/6c52c2722f8460122f96f86346600e1077ce22cb.zip",
"reference": "6c52c2722f8460122f96f86346600e1077ce22cb",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
"sebastian/comparator": "^1.1",
"sebastian/recursion-context": "^1.0|^2.0"
},
"require-dev": {
"phpspec/phpspec": "^2.0",
"phpunit/phpunit": "^4.8 || ^5.6.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.6.x-dev"
}
},
"autoload": {
"psr-0": {
"Prophecy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"time": "2016-11-21 14:58:47"
},
{
"name": "phpunit/php-code-coverage",
"version": "2.2.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/php-code-coverage/eabf68b476ac7d0f73793aada060f1c1a9bf8979.zip",
"reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
"sebastian/environment": "^1.3.2",
"sebastian/version": "~1.0"
},
"require-dev": {
"ext-xdebug": ">=2.1.4",
"phpunit/phpunit": "~4"
},
"suggest": {
"ext-dom": "*",
"ext-xdebug": ">=2.2.1",
"ext-xmlwriter": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"time": "2015-10-06 15:47:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/php-file-iterator/3cc8f69b3028d0f96a9078e6295d86e9bf019be5.zip",
"reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"time": "2016-10-03 07:40:28"
},
{
"name": "phpunit/php-text-template",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/php-text-template/31f8b717e51d9a2afca6c9f046f5d69fc27c8686.zip",
"reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"time": "2015-06-21 13:50:34"
},
{
"name": "phpunit/php-timer",
"version": "1.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/php-timer/38e9124049cf1a164f1e4537caf19c99bf1eb260.zip",
"reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4|~5"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"time": "2016-05-12 18:03:57"
},
{
"name": "phpunit/php-token-stream",
"version": "1.4.9",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/php-token-stream/3b402f65a4cc90abf6e1104e388b896ce209631b.zip",
"reference": "3b402f65a4cc90abf6e1104e388b896ce209631b",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Wrapper around PHP's tokenizer extension.",
"homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
"time": "2016-11-15 14:06:22"
},
{
"name": "phpunit/phpunit",
"version": "4.8.32",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "f5e1941a8dacf0d904753ff2895c6f68e54bcee1"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/phpunit/f5e1941a8dacf0d904753ff2895c6f68e54bcee1.zip",
"reference": "f5e1941a8dacf0d904753ff2895c6f68e54bcee1",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-json": "*",
"ext-pcre": "*",
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpspec/prophecy": "^1.3.1",
"phpunit/php-code-coverage": "~2.1",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.2.2",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.3",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.1|~3.0"
},
"suggest": {
"phpunit/php-invoker": "~1.1"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.8.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2017-01-22 08:37:05"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "2.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/phpunit-mock-objects/ac8e7a3db35738d56ee9a76e78a4e03d97628983.zip",
"reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.0.2",
"php": ">=5.3.3",
"phpunit/php-text-template": "~1.2",
"sebastian/exporter": "~1.2"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"suggest": {
"ext-soap": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sb@sebastian-bergmann.de",
"role": "lead"
}
],
"description": "Mock Object library for PHPUnit",
"homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/",
"keywords": [
"mock",
"xunit"
],
"time": "2015-10-02 06:51:40"
},
{
"name": "sebastian/comparator",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/comparator/6a1ed12e8b2409076ab22e3897126211ff8b1f7f.zip",
"reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/diff": "~1.2",
"sebastian/exporter": "~1.2 || ~2.0"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "http://www.github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"time": "2016-11-19 09:18:40"
},
{
"name": "sebastian/diff",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/diff/13edfd8706462032c2f52b4b862974dd46b71c9e.zip",
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff"
],
"time": "2015-12-08 07:14:41"
},
{
"name": "sebastian/environment",
"version": "1.3.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/environment/be2c607e43ce4c89ecd60e75c6a85c126e754aea.zip",
"reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"time": "2016-08-18 05:49:44"
},
{
"name": "sebastian/exporter",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/exporter/42c4c2eec485ee3e159ec9884f95b431287edde4.zip",
"reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"sebastian/recursion-context": "~1.0"
},
"require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "http://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"time": "2016-06-17 09:04:28"
},
{
"name": "sebastian/global-state",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/global-state/bc37d50fea7d017d3d340f230811c9f1d7280af4.zip",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2015-10-12 03:26:01"
},
{
"name": "sebastian/recursion-context",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/recursion-context/913401df809e99e4f47b27cdd781f4a258d58791.zip",
"reference": "913401df809e99e4f47b27cdd781f4a258d58791",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2015-11-11 19:50:13"
},
{
"name": "sebastian/version",
"version": "1.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/sebastianbergmann/version/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6.zip",
"reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6",
"shasum": ""
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2015-06-21 13:59:46"
},
{
"name": "symfony/dom-crawler",
"version": "v2.8.16",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
"reference": "52cc211afa9458c0a54c478010a55f44892c1c02"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/symfony/dom-crawler/52cc211afa9458c0a54c478010a55f44892c1c02.zip",
"reference": "52cc211afa9458c0a54c478010a55f44892c1c02",
"shasum": ""
},
"require": {
"php": ">=5.3.9",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"symfony/css-selector": "~2.8|~3.0.0"
},
"suggest": {
"symfony/css-selector": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\DomCrawler\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
"time": "2017-01-02 20:30:24"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/symfony/polyfill-mbstring/e79d363049d1c2128f133a2667e4f4190904f7f4.zip",
"reference": "e79d363049d1c2128f133a2667e4f4190904f7f4",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2016-11-14 01:06:16"
},
{
"name": "symfony/yaml",
"version": "v3.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "50eadbd7926e31842893c957eca362b21592a97d"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/symfony/yaml/50eadbd7926e31842893c957eca362b21592a97d.zip",
"reference": "50eadbd7926e31842893c957eca362b21592a97d",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"symfony/console": "~2.8|~3.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.2-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Yaml\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2017-01-03 13:51:32"
},
{
"name": "topthink/framework",
"version": "v5.0.5",
"source": {
"type": "git",
"url": "https://github.com/top-think/framework.git",
"reference": "86cc9378a0c46e66dabed6681f8b8de758585ae1"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/framework/86cc9378a0c46e66dabed6681f8b8de758585ae1.zip",
"reference": "86cc9378a0c46e66dabed6681f8b8de758585ae1",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"topthink/think-installer": "~1.0"
},
"require-dev": {
"johnkary/phpunit-speedtrap": "^1.0",
"mikey179/vfsstream": "~1.6",
"phpdocumentor/reflection-docblock": "^2.0",
"phploc/phploc": "2.*",
"phpunit/phpunit": "4.8.*",
"sebastian/phpcpd": "2.*"
},
"type": "think-framework",
"autoload": {
"psr-4": {
"think\\": "library/think"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "the new thinkphp framework",
"homepage": "http://thinkphp.cn/",
"keywords": [
"framework",
"orm",
"thinkphp"
],
"time": "2017-01-23 05:59:21"
},
{
"name": "topthink/think-angular",
"version": "1.0.9",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-angular.git",
"reference": "71c5d575f654b16fe708a22315612ed92cc42dc5"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-angular/71c5d575f654b16fe708a22315612ed92cc42dc5.zip",
"reference": "71c5d575f654b16fe708a22315612ed92cc42dc5",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"type": "library",
"autoload": {
"classmap": {
"think\\view\\driver\\Angular": "drivers/thinkphp5/Angular.php"
},
"psr-4": {
"think\\angular\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache2"
],
"authors": [
{
"name": "玩具机器人",
"email": "zhaishuaigan@qq.com"
}
],
"description": "think angular view engine",
"homepage": "http://kancloud.cn/shuai/php-angular",
"time": "2016-12-21 04:21:12"
},
{
"name": "topthink/think-captcha",
"version": "v1.0.7",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-captcha.git",
"reference": "0c55455df26a1626a60d0dc35d2d89002b741d44"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-captcha/0c55455df26a1626a60d0dc35d2d89002b741d44.zip",
"reference": "0c55455df26a1626a60d0dc35d2d89002b741d44",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"think\\captcha\\": "src/"
},
"files": [
"src/helper.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"description": "captcha package for thinkphp5",
"time": "2016-07-06 01:47:11"
},
{
"name": "topthink/think-helper",
"version": "v1.0.5",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-helper.git",
"reference": "ed64408cdc4cdbd390365ba0906d208b987af520"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-helper/ed64408cdc4cdbd390365ba0906d208b987af520.zip",
"reference": "ed64408cdc4cdbd390365ba0906d208b987af520",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"think\\helper\\": "src"
},
"files": [
"src/helper.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"description": "The ThinkPHP5 Helper Package",
"time": "2016-12-01 07:08:40"
},
{
"name": "topthink/think-image",
"version": "v1.0.7",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-image.git",
"reference": "8586cf47f117481c6d415b20f7dedf62e79d5512"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-image/8586cf47f117481c6d415b20f7dedf62e79d5512.zip",
"reference": "8586cf47f117481c6d415b20f7dedf62e79d5512",
"shasum": ""
},
"require": {
"ext-gd": "*"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
"topthink/framework": "^5.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"description": "The ThinkPHP5 Image Package",
"time": "2016-09-29 06:05:43"
},
{
"name": "topthink/think-installer",
"version": "v1.0.11",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-installer.git",
"reference": "4c6e1ebecd1afce3f4ccc47e147d61bbe1bf641d"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-installer/4c6e1ebecd1afce3f4ccc47e147d61bbe1bf641d.zip",
"reference": "4c6e1ebecd1afce3f4ccc47e147d61bbe1bf641d",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0"
},
"require-dev": {
"composer/composer": "1.0.*@dev"
},
"type": "composer-plugin",
"extra": {
"class": "think\\composer\\Plugin"
},
"autoload": {
"psr-4": {
"think\\composer\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"time": "2016-12-01 09:08:45"
},
{
"name": "topthink/think-migration",
"version": "v1.0.6",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-migration.git",
"reference": "b2960f9b86c9231f593d5cfb84798176e332c987"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-migration/b2960f9b86c9231f593d5cfb84798176e332c987.zip",
"reference": "b2960f9b86c9231f593d5cfb84798176e332c987",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"Phinx\\": "phinx/src/Phinx",
"think\\migration\\": "src"
},
"files": [
"src/config.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"time": "2016-10-17 03:31:17"
},
{
"name": "topthink/think-mongo",
"version": "v1.2",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-mongo.git",
"reference": "d26ddc47e85d2a1a41a6e38f155610a1c8f66f70"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-mongo/d26ddc47e85d2a1a41a6e38f155610a1c8f66f70.zip",
"reference": "d26ddc47e85d2a1a41a6e38f155610a1c8f66f70",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"think\\mongo\\": "src"
},
"files": []
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "mongodb driver for thinkphp5",
"time": "2016-11-17 13:20:01"
},
{
"name": "topthink/think-queue",
"version": "v1.1.2",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-queue.git",
"reference": "503c5b809585ca60cba9485a233aa8be4b22c990"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-queue/503c5b809585ca60cba9485a233aa8be4b22c990.zip",
"reference": "503c5b809585ca60cba9485a233aa8be4b22c990",
"shasum": ""
},
"require": {
"topthink/think-helper": ">=1.0.4",
"topthink/think-installer": ">=1.0.10"
},
"type": "think-extend",
"extra": {
"think-config": {
"queue": "src/config.php"
}
},
"autoload": {
"psr-4": {
"think\\": "src"
},
"files": [
"src/common.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"description": "The ThinkPHP5 Queue Package",
"time": "2016-12-01 04:29:39"
},
{
"name": "topthink/think-sae",
"version": "v1.1",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-sae.git",
"reference": "e31ee4ec073c0ffc5dbc7292f8268661e5265091"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-sae/e31ee4ec073c0ffc5dbc7292f8268661e5265091.zip",
"reference": "e31ee4ec073c0ffc5dbc7292f8268661e5265091",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"think\\sae\\": "src"
},
"files": []
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "sae support for thinkphp5",
"time": "2016-10-08 10:53:21"
},
{
"name": "topthink/think-testing",
"version": "v1.0.6",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-testing.git",
"reference": "e89794e5c58aa5587f7b08038e9468150870b185"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-testing/e89794e5c58aa5587f7b08038e9468150870b185.zip",
"reference": "e89794e5c58aa5587f7b08038e9468150870b185",
"shasum": ""
},
"require": {
"phpunit/phpunit": "^4.8.26",
"symfony/dom-crawler": "^2.8.8",
"topthink/think-helper": "~1.0",
"topthink/think-installer": "~1.0"
},
"type": "think-testing",
"autoload": {
"psr-4": {
"think\\testing\\": "src"
},
"files": [
"src/config.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "yunwuxin",
"email": "448901948@qq.com"
}
],
"time": "2016-08-08 09:43:56"
},
{
"name": "topthink/think-worker",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/top-think/think-worker.git",
"reference": "b609ff5e38dbb7194aab027d2b2c6b31a7ed1bd1"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/top-think/think-worker/b609ff5e38dbb7194aab027d2b2c6b31a7ed1bd1.zip",
"reference": "b609ff5e38dbb7194aab027d2b2c6b31a7ed1bd1",
"shasum": ""
},
"require": {
"workerman/workerman": "^3.3.0"
},
"type": "library",
"autoload": {
"psr-4": {
"think\\worker\\": "src"
},
"files": []
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "liu21st",
"email": "liu21st@gmail.com"
}
],
"description": "workerman extend for thinkphp5",
"time": "2016-10-08 06:07:03"
},
{
"name": "webmozart/assert",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/webmozart/assert/2db61e59ff05fe5126d152bd0655c9ea113e550f.zip",
"reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
"shasum": ""
},
"require": {
"php": "^5.3.3 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^4.6",
"sebastian/version": "^1.0.1"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2016-11-23 20:04:58"
},
{
"name": "workerman/workerman",
"version": "v3.3.6",
"source": {
"type": "git",
"url": "https://github.com/walkor/Workerman.git",
"reference": "cc02f47bb7bd5f2ce053cf75fcac02565aa729cf"
},
"dist": {
"type": "zip",
"url": "https://packagist.phpcomposer.com/files/walkor/Workerman/cc02f47bb7bd5f2ce053cf75fcac02565aa729cf.zip",
"reference": "cc02f47bb7bd5f2ce053cf75fcac02565aa729cf",
"shasum": ""
},
"require": {
"php": ">=5.3"
},
"suggest": {
"ext-event": "For better performance."
},
"type": "library",
"autoload": {
"psr-4": {
"Workerman\\": "./"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "http://www.workerman.net",
"role": "Developer"
}
],
"description": "An asynchronous event driven PHP framework for easily building fast, scalable network applications.",
"homepage": "http://www.workerman.net",
"keywords": [
"asynchronous",
"event-loop"
],
"time": "2016-12-22 14:28:34"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.4.0"
},
"platform-dev": []
}
... ...
*
!.gitignore
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">application/</directory>
</whitelist>
</filter>
</phpunit>
... ...
不能预览此文件类型
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
// 定义应用目录
define('APP_PATH', __DIR__ . '/../application/');
// 加载框架引导文件
require __DIR__ . '/../thinkphp/start.php';
... ...
User-agent: *
Disallow:
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// $Id$
if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["REQUEST_URI"])) {
return false;
} else {
require __DIR__ . "/index.php";
}
... ...
*
!.gitignore
\ No newline at end of file
... ...
*
!.gitignore
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
namespace tests;
class ExampleTest extends TestCase
{
public function testBasicExample()
{
$this->visit('/')->see('ThinkPHP');
}
}
\ No newline at end of file
... ...
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
namespace tests;
class TestCase extends \think\testing\TestCase
{
protected $baseUrl = 'http://localhost';
}
\ No newline at end of file
... ...
#!/usr/bin/env php
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
// 定义项目路径
define('APP_PATH', __DIR__ . '/application/');
// 加载框架引导文件
require './thinkphp/console.php';
\ No newline at end of file
... ...
/composer.lock
/vendor
.idea
.DS_Store
... ...
deny from all
\ No newline at end of file
... ...
sudo: false
language: php
services:
- memcached
- mongodb
- mysql
- postgresql
- redis-server
matrix:
fast_finish: true
include:
- php: 5.4
- php: 5.5
- php: 5.6
- php: 7.0
- php: hhvm
allow_failures:
- php: hhvm
cache:
directories:
- $HOME/.composer/cache
before_install:
- composer self-update
- mysql -e "create database IF NOT EXISTS test;" -uroot
- psql -c 'DROP DATABASE IF EXISTS test;' -U postgres
- psql -c 'create database test;' -U postgres
install:
- ./tests/script/install.sh
script:
## LINT
- find . -path ./vendor -prune -o -type f -name \*.php -exec php -l {} \;
## PHP Copy/Paste Detector
- vendor/bin/phpcpd --verbose --exclude vendor ./ || true
## PHPLOC
- vendor/bin/phploc --exclude vendor ./
## PHPUNIT
- vendor/bin/phpunit --coverage-clover=coverage.xml --configuration=phpunit.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
... ...