我正在尝试使用php检查系统要求。但我有一个问题。
我尝试了以下代码:
function CheckEveryThinkOk(){
$version = phpversion();
if(($version >= 5.3) && (function_exists('mysqli_connect')) && (in_array('mod_rewrite', apache_get_modules())) && (ini_get('short_open_tag')) && (file_exists('../../.htaccess')) && (is_writable('../../core'))){
return '<div class="continuenextstep">Next Step</div>';
} else {
return '<div class="missingSomething">Some requirements seem to be missing.</div>';
}
}
问题是。一切都是TRUE
。但我的代码返回<div class="missingSomething">Some requirements seem to be missing.</div>
。
它应该返回<div class="continuenextstep">Next Step</div>
。我在这里想念的任何人都可以告诉我吗?
答案 0 :(得分:0)
逻辑不清楚
if(($version >= 5.3) || (function_exists('mysqli_connect')) || (in_array('mod_rewrite', apache_get_modules())) || (ini_get('short_open_tag')) || (file_exists('../../.htaccess')) || (is_writable('../../core'))){ ....
可能是
function CheckEveryThinkOk(){
$version = phpversion();
clearstatcache(true,$_SERVER['DOCUMENT_ROOT'].'/.htaccess');
clearstatcache(true,$_SERVER['DOCUMENT_ROOT'].'/core');
if(($version >= 5.3) and (function_exists('mysqli_connect')) and (in_array('mod_rewrite', apache_get_modules())) and (ini_get('short_open_tag')) and (file_exists($_SERVER['DOCUMENT_ROOT'].'/.htaccess')) and (file_exists($_SERVER['DOCUMENT_ROOT'].'/core'))){
return '<div class="continuenextstep">Next Step</div>';
} else {
return '<div class="missingSomething">Some requirements seem to be missing.</div>';
}
}