Category : PHP

restful API

2017-11-25PHP Standard

说明 1. 在RESTful架构中,每个网址代表一种资源(resource),所以网址中不能有动词,只能有名词Read more

PhpStorm配置Xdebug调试

2017-03-13PHP, 开发工具 Standard

xdebug 安装 打开 https://xdebug.org/wizard.php 复制phpinfo的信息Read more

laravel 订单通知队列

2017-03-07PHP Standard

需求 订单完成支付后通知服务器已到账,通知失败则重试,最多3次,第二次5秒后,第三次10秒后 实现方案一 生成Read more

laravel自定义用户认证

2016-12-23PHP Standard

添加自定义的 Guard

需要通过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;
    });
}

Read more

抽奖概率算法

2015-05-21PHP Standard

$reward = array( 0=>array(‘id’=>0,&#8Read more

mcrypt_encrypt() Size of key is too large for this algorithm in …

2015-02-03PHP Standard

function encrypt($str, $key) { $block = mcrypt_get_blocRead more

在 Ubuntu 中安装 Laravel

2014-12-09PHP Standard

安装 Composer curl -sS https://getcomposer.org/installer Read more

Laravel requires the Mcrypt PHP extension.

2014-08-12PHP Standard

I am trying to use the migrate function in Laravel 4 on OSX, however I am getting the error

​Laravel requires the Mcrypt PHP extension.

What is wrong, and how can I fix it?

Read more

mac下安装oci8扩展来支持php连接oracle

2014-05-21MAC, PHP Standard

下载oci8扩展包:
http://pecl.php.net/package/oci8

cd到解压目录执行phpize,发现错误,

错误提示:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

解决方法:
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gztar xzf autoconf-latest.tar.gz
cd autoconf-*./configure –prefix=/usr/local
make
sudo make install

Read more

通过传递session_id解决uploadify上传PHP中丢失SESSION值的问题

2014-05-08PHP, 前端 Standard

 

由于uploadify通过flash提交上传的文件,会导致在接收文件的PHP端出现获取SESSION值为空的情况,如果你要在PHP端验证用户的登录状态或验证用户输入的验证码是否正确你就需要解决SESSION取值的问题,下面给出uploadify上传中获取SESSION的方法:

Read more

1 2 3