我最近升级到 Joomla 3.5.1,当我在我的根目录中加载/包含一个 php 文件时出现以下错误。
"Error displaying the error page: Application Instantiation Error: Failed to start the session because headers have already been sent by test.php at line 1"
我正在模块中加载 test.php 文件。 test.php 位于 joomla 安装的主根目录中。但是,由于 Joomla 本身已经设置了 session ,由于上述 session 错误,我无法通过 test.php 访问 joomla 数据库。
在 test.php 中,我有以下代码作为开始;
<?php
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__)));
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();
升级前一切正常。当我加载外部 php 文件访问 joomla 数据库时,如何防止 Joomla 中的 session 冲突?
最佳答案
通常,此问题是由文件开头的几乎不引人注意的空格(或新行)引起的。在打开 之前检查你的 test.php 文件是否有空格
关于php - Joomla 3.5.1 session 冲突 - 已发送重复的 session header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37229614/