- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我刚刚更改了所有代码以使用 __autoload,发现它与 joomla 自动加载器冲突。在某些情况下,我将我的应用程序与 joomla 集成以注册用户等。
我发现 spl_autoload_register() 显然允许许多自动加载器。
我该怎么办?
更新:这就是 joomla 所做的
从/library/loader.php 加载这个文件
function __autoload($class)
{
if(JLoader::load($class)) {
return true;
}
return false;
}
更新 2:
好的,在我加载 Joomla 库后立即调用
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
//autoloader so that it does not interfere with mine
spl_autoload_register('__autoload');
这是我的自动加载的样子:
<?php
//IMPORT
function myAutoload($class_name)
{
$path = str_replace('_', '/', $class_name);
include $path . '.php';
}
?>
spl_autoload_register('myAutoload',false,true);
首先调用我的,然后再调用 joomla,但是,该应用程序仍然找不到 Joomla 类。
更新 3:
运行后:
echo "PRE: myAutoload:" . spl_autoload_functions() . "<br />";
spl_autoload_register('myAutoload',false,true);
echo "POST: myAutoload:" . spl_autoload_functions() . "<br />";
和
echo "PRE: JoomlaAutoLoad:" . spl_autoload_functions() . "<br />";
//autoloader so that it does not interfere with mine
spl_autoload_register('__autoload');
echo "POST: JoomlaAutoLoad:" . spl_autoload_functions() . "<br />";
我的输出是:上一篇:我的自动加载:发布:我的自动加载:数组
我必须将 Joomla 导入更改为:
require_once ( JPATH_BASE .DS.'libraries'.DS.'loader.php' );
echo "PRE: JoomlaAutoLoad:" . var_dump(spl_autoload_functions()) . "<br />";
//autoloader so that it does not interfere with mine
spl_autoload_register('__autoload');
echo "POST: JoomlaAutoLoad:" . var_dump(spl_autoload_functions()) . "<br />";
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
这是输出
PRE: myAutoload:
array
0 => string 'myAutoload' (length=10)
POST: myAutoload:
array
0 => string 'myAutoload' (length=10)
PRE: JoomlaAutoLoad:
array
0 => string 'myAutoload' (length=10)
1 => string '__autoload' (length=10)
POST: JoomlaAutoLoad:
在包含这些 Joomla 文件后,我发现了这一点
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
spl_autoload_functions() 不返回任何内容,因此 joomla 以某种方式将其填充。
最佳答案
您应该决定哪个自动加载函数应该优先于另一个,并相应地使用 spl_autoload_register()
(查看第三个参数)。 Joomla自动加载功能是如何注册的?
关于php - __autoload 灾难 - 与 Joomla 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3037270/
我正在为 Windows 应用程序编写 DLL 插件,添加以下内容后包括: #include #include 我得到一个奇妙的编译错误: Error 3 error C2143: syntax
这让我有点疯狂.. 下面是迄今为止我的程序的屏幕截图。 右边是一个 NSTableView(基于 View )。用户可以在此处选择他们想要处理的文档。 左边是 NSTextView。文本的显示取决于他
当我在 Google 上搜索我们的网站时,我发现显示了三个内容相同的网站。我一直以为我们只使用一个站点 www.foo.com,但事实证明我们有 www.foo.net 和 www.foo.info,
昨天我遇到了痛苦,这让我沮丧了 24 小时。问题归结为随机发生的意外崩溃。使事情复杂化的是,调试报告也具有绝对随机 模式。更复杂的是,所有调试跟踪都指向随机 Qt 源或 native DLL,即每次都
在我们与业务层断开连接并通过 MVC Web API 进行通信的 Winforms 客户端应用程序中,我们收到了一个严重的错误。哪位高手能解释一下! 这是什么意思呢? ---> (Inner Exce
我是一名前端开发人员,我正在使用 react-admin 开发一个网络应用程序元素。 代码很好,没有错误。我启动应用程序。起初它看起来像它应该的样子。一些带有表格、菜单栏等的组件。但是,在单击几下之后
我一直在研究如何使 Bootstrap 与 IE 8 一起工作,但它仍然看起来像这样: 到目前为止我做了什么: 插入 插入 respond.js -> 但还是一样。问题是子域吗?还是我的 IE 8
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 关于您编写的代码问题的问题必须在问题本身中描述具体问题 — 并且包括有效代码 以重现它。参见 SSC
我刚刚更改了所有代码以使用 __autoload,发现它与 joomla 自动加载器冲突。在某些情况下,我将我的应用程序与 joomla 集成以注册用户等。 我发现 spl_autoload_regi
无法在任何地方得到任何爱,这很难相信。 NetStream 上的实时流和缓冲区不混合。为什么?文档并没有说你不能这样做。 播放被灌输。缓冲区应该填充到您在播放前设置的内容。但是,大约有一半的时间,播放
我正在尝试用 Rust 实现 BST。我的结构看起来像这样: pub struct Node { key: T, parent: Option>>, left: Opti
目标: json_encode 具有私有(private)属性的 PHP 对象 通过 Low Level AJAX 将编码后的对象作为数据字符串发送使用 jQuery json_decode 请求发送
我花了很多时间在网页上工作,并且懒得将东西提交给 Git。今天,我试图将所有内容推送到我的 repo 协议(protocol),但我认为我可能造成了灾难。我是 Git 的新手,基本上只是将它用于最基本
我是一名优秀的程序员,十分优秀!