restful API
说明 1. 在RESTful架构中,每个网址代表一种资源(resource),所以网址中不能有动词,只能有名词,而且所用的名词一般与数据库的表格名对应。 2.对于资源的具体操作类型,由HTTP动词表示。常用的HTTP动词有下面五个(括号里是对应的SQL命令)。 GET(SE […]
说明 1. 在RESTful架构中,每个网址代表一种资源(resource),所以网址中不能有动词,只能有名词,而且所用的名词一般与数据库的表格名对应。 2.对于资源的具体操作类型,由HTTP动词表示。常用的HTTP动词有下面五个(括号里是对应的SQL命令)。 GET(SE […]
nginx 配置 location / { if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rew […]
添加头部headers // 新创建 axios 实例配置 const $axios = axios.create({ baseURL: ‘http://domain.com’, timeout: 5000, headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, ‘sessionId’: Lo […]
xdebug 安装 打开 https://xdebug.org/wizard.php 复制phpinfo的信息到文本框,会返回安装指导: Tailored Installation Instructions Summary Xdebug installed: no Server API: FPM/FastCGI Windows: no Zend Server: no PHP Version: 5.6.9 Zend API n […]
需求 订单完成支付后通知服务器已到账,通知失败则重试,最多3次,第二次5秒后,第三次10秒后 实现方案一 生成任务类 php artisan make:job PaymentNotify 命令将会在app/Jobs目录下生成一个新的类,编辑: < ?php namespace App\Jobs; use App\Ex […]
需要通过Auth门面的extend方法定义自己的认证guard,在App\Providers\AuthServiceProvider的boot方法中实现:
public function boot()
{
$this->registerPolicies();
Auth::extend('XXX', function($app, $name, array $config) {
// 返回 Illuminate\Contracts\Auth\Guard 实例
$guard = new XXXGuard($name,Auth::createUserProvider($config['provider']),$this->app['session.store']);
//事件
if (method_exists($guard, 'setDispatcher')) {
$guard->setDispatcher($this->app['events']);
}
//请求
if (method_exists($guard, 'setRequest')) {
$guard->setRequest($this->app->refresh('request', $guard, 'setRequest'));
}
return $guard;
});
}
[...]
在 2016 年做 PHP 开发是一种什么样的体验?(一) 嘿,我最近接到一个网站开发的项目,不过老实说,我这两年没怎么接触编程,听说 Web 技术已经发生了一些变化。听说你是这里对新技术最了解的开发工程师? 你算是找对人了。我对今年的技术别提多熟了, V […]