thinkphp的nginx配置pathinfo模式,适用3.2 5.0

tp-nginx-config

server
{
# 适用于 thinkphp 3.2 thinkphp 5.0
# pathinfo 模式
# 模块/控制器/方法/参数
# 3.2 使用方法 /home/index/index/params
# 5.0 使用方法 /index/index/index/params
listen 80;
server_name tp;#mod this line
index index.php index.html;
root /tpdir; #mod this line

location / {
index index.php index.htm;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000; #mod this line
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
if ($fastcgi_script_name ~ “^(.+?\.php)(/.+)$”) {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param PATH_INFO $path_info;
}

}

dedecms 获取分页后的页面地址 arcurl2

{dede:field name=’arcurl’ /} 只能获得当前地址的,但是分页获取不到

{dede:field name=’arcurl2′ /} 我设置修改  include\arc.archives.class.php

$this->Fields[‘arcurl2’] = substr($this->Fields[‘arcurl’],0,-5) . “_” . $i . substr($this->Fields[‘arcurl’],-5) ;

 

微信开放平台,全网发布的问题,微擎程序错误

全网发布测试出现 ,

返回Api文本消息 【失败】

返回普通文本消息 【失败】

测试地址 http://微擎web地址/api.php

 

如下图

经过修改api.php 加入调试语句 ,一般是

error_log(__LINE__ . PHP_EOL , 3, “zjpro.txt”);

或者

error_log(print_r($_GET,true) . PHP_EOL , 3, “zjpro.txt”);

调试出来一些GET参数后,就可以直接对api.php加参数测试了

测试地址 http://微擎web地址/api.php?appid=/xxxxx&……………………………………

然后调试api.php 得到正确的结果。

可能是 微擎的web 和 app 目录里面的common 目录的问题!

因为 load()->app(‘common’); 这行出错了。

经过 var_dump(load()) ; 发现 app 目录下不存在 common 目录,但是在web下存在。复制到app下解决。

 

php 的按位计算的一点备用

话说php的预定义变量 (只考虑 PHP7情况吧)

E_ALL  是  30719 (111011111111111) 15个错误提示位,

E_STRICT 是 000100000000000 用于补第4位的错误提示

E_NOTICE 是 8 (000000000001000)

E_ALL | E_STRICT ^ E_NOTICE 可以表示为

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1     E_ALL | E_STRICT
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0     E_NOTICE

结果是 111111111110111

E_ALL | E_STRICT & ~E_NOTICE 可以表示为

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  E_ALL | E_STRICT
1 1 1 1 1 1 1 1 1 1 1 0 1 1 1  ~E_NOTICE

结果是  111111111110111

从而可以理解为什么 有两种写法

error_reporting(E_ALL | E_STRICT ^ E_NOTICE);

error_reporting(E_ALL | E_STRICT & ~E_NOTICE);

 

 

 

sc 命令的用法

参考 https://jingyan.baidu.com/article/456c463b420f5e0a583144dd.html

简要介绍是:

  1. 设置服务的自启动性质 sc config 服务名 start= auto|demand|disabled
  2. 设置服务启动关闭   sc start|stop 服务名
  3. 删除服务名  sc delete 服务名
  4. 查询服务状态 sc query 服务名