目录
- PHP在安装过程中会监测Redis
- h5跨域
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跨域
template\uni-app\manifest.json
"h5" : {
"devServer" : {
"https" : false,
"proxy": {
"/api": {
"target": "http://localhost",
"changeOrigin": true, //是否跨域
"secure": false // 设置支持https协议的代理
}
}
},