yii2.0实现pathinfo的形式访问的配置方法
yii2.0默认的访问形式为:dxr.com/index.php?r=index/list,一般我们都会配置成pathinfo的形式来访问:dxr.com/index/list,这样更符合用户习惯。
具体的配置方法为:
一.配置yii2.0。
打开config目录下的web.php,在$config = [ 'components'=>[ 加到这里 ] ]中加入:
'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ ], ],
此时,yii2.0已经支持以pathinfo的形式访问了,如果此时访问不了,继续往下看。
二.配置web服务器。
1.如果是apache,在入口文件(index.php)所在的目录下新建一个文本文件,接着另存为.htaccess,用记事本打开此文件加入:
RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php
保存即可。
2.如果是nginx,在nginx配置文件中加入:
server { listen 80; server_name localhost; location / { root E:/wwwroot/yii2.0; index index.html index.php; if (!-e $request_filename){ rewrite ^/(.*) /index.php last; } } location ~ .php$ { root E:/wwwroot/yii2.0; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
三:重启web服务器。
至此,配置完毕。
php制作简单模版引擎
PHP模板引擎就是一个PHP类库,使用它可以使PHP代码和HTML代码进行分离,使代码的可读性和维护性得到显著提高。而且这样做的好处是,让美工专心设计H
php生成验证码,缩略图及水印图的类分享
封装了一个类,可生成验证码,缩略图,及水印图,分享给大家phpclassimage{session_start();//验证码类staticpublicfunctionverify($code,$width=75,$height=25,$n=4){header("cont
人脸识别测颜值、测脸龄、测相似度微信接口
人脸评分微信接口,获取微信图片地址,curl请求face++接口。解析json数据,计算颜值。返回用户。颜值匹配版,请到腾讯微校上体验。http://weixiao.qq.comphp
编辑:广州鸿名健康科技有限公司
标签:验证码,水印,接口,形式,代码