我有一个joomla网站,我正在创建一个带有.php的照片库,调用带有query1 SELECT的图片(这个php用完joomla但是从joomla DB调用图片)
当gallery.php位于我网站的根目录时,它的工作正常。但是当我想将它插入文件夹时,我得到了这个错误:
Warning: require_once(/homez.420/xxxxx/www/gallery/includes/defines.php) [function.require-once]: failed to open stream: No such file or directory in /homez.420/xxxxx/www/gallery/gallery.php on line 30
Fatal error: require_once() [function.require]: Failed opening required '/homez.420/xxxxx/www/gallery/includes/defines.php' (include_path='.:/usr/local/lib/php') in /homez.420/xxxxx/www/gallery/gallery.php on line 30
我还是php的新手,我无法找到一种方法来找到如何让这两行跳出gallery文件夹,以便它调用此文档:/homez.420/xxxxx/ WWW /包括 /defines.php
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
这是完整的代码
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) ); //this is line 30 : where the glitch is
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$db = &JFactory::getDBO();
?>
非常感谢你的帮助!
答案 0 :(得分:0)
解决方案很简单: 替换第30行:
define('JPATH_BASE', dirname(__FILE__) );
按网站根路径:
define('JPATH_BASE', '/homez.420/xxxxxxx/www');