我有这个代码将检查(a)商店是否在线和(b)目录/store是否可用:
<?php
// Set flag that this is a parent file
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(realpath(__FILE__)). '/../store' );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
jimport('joomla.application.module.helper');
jimport('joomla.application.component.helper');
$mainframe =& JFactory::getApplication('site');
$filename = '../store/';
if (!$mainframe->getCfg('offline') && file_exists($filename))
{
echo "online";
}
else
{
echo "offline";
}
?>
当我在我的控制面板中将商店设置为离线时,它工作正常,但是当目录/store的名称已更改或被删除(变得不可用)时,页面会生成服务器错误,而它应该回显“离线”。我该如何修改它,以便当目录名称更改时,它会更改它以回显“离线”