PHP opendir() 函数问题

标签 php

$result = 'false';
if( opendir( $this->OuterTemplateDirPath != false ) ){
   $result = 'true';
}
return $result;

我的 fxn 和外模板等于 $_SERVER['DOCUMENT_ROOT' ] . 'mysite.com/templates/admin/structure/outertemplate/ .

但它返回并显示错误:

Warning: opendir(1) [function.opendir]: failed to open dir: No such file or directory in C:\wamp\www\mysite.com\templates\admin\structure\structure.php on line 411

问题出在哪里?应该是什么

最佳答案

你的括号似乎放错地方了。您将 bool 值(将模板目录与 false 进行比较的返回值)传递给 opendir() 而不是目录。

if (opendir($this->OuterTemplateDirPath) != false) { 

关于PHP opendir() 函数问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4152117/

相关文章:

php - 我可以连接来自不同数据库的两个表吗?

php - 如何获取调用函数的脚本的名称?

php - 这会有副作用吗?

php - 如何检查产品是否由 woocommerce 中的用户创建

php - 如何为 HTML 表单生成器创建逻辑语法

php - 使用PHP从android连接mysql

php - 为什么我应该使用/不使用可空字段 Laravel - MySQL

PHP file_get_contents 错误 503

PHP 表不会使用 AJAX 更新 Mysql

PHP和数据库连接错误