PHP在安装过程中会监测Redis
public\install\index.php
if (extension_loaded('redis')) {
$redis = '<span class="correct_span">√</span> 已安装';
} else {
$redis = '<a href="https://doc.crmeb.com/web/single/crmeb_v4/913" target="_blank"><span class="correct_span error_span">√</span> 点击查看帮助</a>';
$err++;
}
public\install\templates\step2.php
<tr>
<td>redis</td>
<td>必须开启</td>
<td><?php echo $redis; ?></td>
<td>启用</td>
</tr>
public\install\templates\step3.php
function redisDbPwd(connect_db) {
var data = {
rbhost: $('#rbhost').val(),
rbport: $("#rbport").val(),
rbselect: $("#rbselect").val(),
rbpw: $('#rbpw').val(),
};
var url = "<?php echo $_SERVER['PHP_SELF']; ?>?step=3&redisdbpwd=1";
console.log(url);
$.ajax({
type: "POST",
url: url,
data: data,
dataType: 'JSON',
beforeSend: function () {
},
success: function (msg) {
if (msg == 1) {
// $('#J_install_redis_host').html('<span generated="true" class="tips_success" style="">地址配置正确</span>');
// $('#J_install_redis_port').html('<span generated="true" class="tips_success" style="">端口配置正确</span>');
// $('#J_install_redis_select').html('<span generated="true" class="tips_success" style="">库可用</span>');
$('#J_install_redis_dbpw').html('<span generated="true" class="tips_success" style="">配置成功</span>');
redisstatu = true;
} else if (msg == -1) {
$('#J_install_redis_host').html('<span for="dbname" generated="true" class="tips_error" style="">Redis扩展没有安装</span>');
redisstatu = false;
} else if (msg == -3) {
$('#J_install_redis_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">Redis数据库没有启动或者配置信息错误</span>');
redisstatu = false;
} else {
$('#J_install_redis_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">配置失败</span>');
redisstatu = false;
}
},
complete: function () {
},
error: function () {
$('#J_install_redis_dbpw').html('<span for="dbname" generated="true" class="tips_error" style="">数据库链接配置失败</span>');
$('#dbpw').val("");
redisstatu = false;
}
});
}
php要加载Redis扩展,
进入到配置文件后,加入这段代码 extension=php_redis.dll
安装Redis
在任务管理器中杀死PHP相关进程,重启PHP进程。
网站配置
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
NO_AUTO_CREATE_USER 在前面好像会报错。
h5跨域proxy
template\uni-app\manifest.json
"h5" : {
"devServer" : {
"https" : false,
"proxy": {
"/api": {
"target": "http://localhost",
"changeOrigin": true, //是否跨域
"secure": false // 设置支持https协议的代理
}
}
},
vue跨域proxy
template\admin\vue.config.js
module.exports = {
// 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
// devServer: {
// proxy: 'localhost:3000'
// }
devServer: {
。。。。。
proxy: {
'/api': {
target: 'http://localhost',
changeOrigin: true,
pathRewrite: {'^/api': '/api'},
secure:false,
// logLevel: "debug"
},
'^/adminapi': {
target: 'http://localhost',
changeOrigin: true,
pathRewrite: {'^/adminapi': '/adminapi'},
// logLevel: "debug" //打开debug可以看到更多的东西
}
}
},
//publicPath: env === 'development' ? '/admin/' : '/admin/'
}
devtools里面显示的还是proxy之前的URL,实际出去的URL已经被修改
phpstudy修改网站端口号之后要重新设置伪静态
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}