Yii2 如何在modules中添加验证码

最近玩了下Yii2的验证码部分,正常的逻辑都可以走通的,网上的例子也是没有问题的,关键有问题的部分是在module中使用的时候,分享给大家,往下看之前可以去看看正常情况下是如何使用的。controller部分的代码,这里的跟网上的都类似publicfunctionactions(){return['captcha'=>['class'=>'yii\captcha\CaptchaAction','fixedVerifyCode'=>null, ...

Laravel 给生产环境添加监听事件 - SQL日志监听

laravel版本:5.2.*一、创建监听器phpartisanmake:listenerQueryListener--event=Illuminate\\Database\\Events\\QueryExecutedorsudo/usr/local/bin/phpartisanmake:listenerQueryListener--event=Illuminate\\Database\\Events\\QueryExecuted会自动生成文件app/Listeners/QueryListener.php二、注册事件打开app/Providers/EventServiceProvider.php,在$listen中添加Illuminate\Database\Events\QueryExecuted事件的监听器为QueryListenerprotected$listen=['Illuminate\Database\Events\QueryExecuted'=>['App\Listeners\QueryListener',],];最终代码如下namespace&nb...

React中上传图片到qiniu(2017-05-10更新)

之前有写过类似的一篇文章,有位同学突然找来解惑,发现自己采用了另外的一个方法,这里也分享下,希望对使用reactjs的同学有帮助。逻辑思路是这样子的,在componentDidMount中实现更新dom的操作,异步加载需要的资源文件,然后在加载完后实现qiniu的初始化操作。这里就不需要在webpack或者其他打包工具中去引入qiniu的包文件,导致打完包的文件过大了。我这里使用了nodejs的库scriptjs,const$S=require('scriptjs');可以实现异步的加载文件,当然你也可以使用你认为更好的,当然也别忘记告诉我下。以下为代码实现部分:asynccomponentDidMount(){letuploadToken=await...

PHP7 新特性 学习

PHP7的新特性大概浏览下,还是能在工作的效率上有很大益处的。1,性能提升这个我就不做测试了,哈哈2,类型声明classStudent{publicfunction__construct(){$this->name='durban';}}$student=newStudent();functionenroll(Student$student,array$classes){foreach($classesas$class){echo"Enrolling".$student->name."in".$class."\n";&n...

Laravel 之 Left Join 方法使用

举例子如下:$models=static::where('user_id',$userId)->leftJoin('product_gift',function($join){$join->on('product_gift_exchange_order.prd_id','=','product_gift.prd_id');$join->on('product_gift_exchange_order.gift_code','=','product_gift.gift_code');})->orderBy('product_gift_exchange_order.autokid','DESC')->get(['product_gift_exchange_order.autokid','product_gift_exchange_order.ctime','product_gift_exchange_order.exchange_amount','product_gift.g...

sublime text 3 配置分享 - 支持retine屏幕的外设

记录分享{"always_show_minimap_viewport":true,"bold_folder_labels":true,"color_scheme":"Packages/MaterialTheme/schemes/Material-Theme.tmTheme","folder_exclude_patterns":["node_modules"],"font_face":"SourceCodeProForPowerline","font_options":["subpixel_antialias"],"font_size":16,"ignored_packages":["Vintage"],"indent_guide_options":["draw_normal","draw_active"],"line_padding_bottom":0,"line_padding_top":0,"material_theme_accent_scrollbars":true,...

sublime text 3 配置分享

sublimetext3配置分享{"always_show_minimap_viewport":true,"font_face":"SourceCodeProforPowerline","font_size":14,"bold_folder_labels":true,"color_scheme":"Packages/MaterialTheme/schemes/Material-Theme.tmTheme","ignored_packages":["Vintage"],"indent_guide_options":["draw_normal","draw_active"],"translate_tabs_to_spaces":true,"material_theme_accent_acid-lime":true,"material_theme_accent_blue":true,"material_theme_accent_brba":true,"material_theme_accent_bright-teal":true,"mat...