php 如何在 Joomla 中禁用已弃用的消息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7746303/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to disable deprecated messages in Joomla?
提问by user975290
I use Joomla v1.5, and after installing same components I got deprecated messages - how can I disable this messages in Joomla? I can't disable it in php.ini, because I don't have access for php in server.
我使用 Joomla v1.5,在安装相同的组件后,我收到了不推荐使用的消息 - 如何在 Joomla 中禁用此消息?我无法在 php.ini 中禁用它,因为我无法访问服务器中的 php。
回答by Aurelio De Rosa
Put in the index.php file, after this line define( '_JEXEC', 1 );
, this statement:
放入 index.php 文件,在这一行之后define( '_JEXEC', 1 );
,这个语句:
error_reporting(0);
or, as pderaaijsays, use:
或者,正如pderaaij所说,使用:
error_reporting(E_ALL ^ E_DEPRECATED);
As he says,
正如他所说,
In this way all of the other errors are shown, except the deprecated messages.
以这种方式显示所有其他错误,但不推荐使用的消息除外。
回答by ghbarratt
The ideal solution is to set the global configuration setting called "Error Reporting" to either "None" or to "System Default" and then set the "system default" through the use of an .htaccess file on the web root or in the httpd/apache conf.
理想的解决方案是将名为“错误报告”的全局配置设置设置为“无”或“系统默认值”,然后通过使用 Web 根目录或 httpd 中的 .htaccess 文件设置“系统默认值” /apache 配置文件。
To set the value in the .htaccess file you can use:
要在 .htaccess 文件中设置值,您可以使用:
php_value error_reporting 22527
(you can verify this value using php: echo E_ALL ^ E_DEPRECATED;
)
(你可以使用PHP验证这个值:echo E_ALL ^ E_DEPRECATED;
)
AurelioDeRosa's answer proposes to "hack" (!) the core of Joomla. As stated in my comment, placing error_reporting in multiple locations inside the code is bad practice as it should ideally only be set once. The Joomla 1.5 core code sets the error_reporting as appropriately configured in the global configuration.
AurelioDeRosa 的回答建议“破解”(!)Joomla 的核心。正如我的评论中所述,将 error_reporting 放在代码内的多个位置是不好的做法,因为理想情况下它应该只设置一次。Joomla 1.5 核心代码将 error_reporting 设置为全局配置中的适当配置。
回答by Rawazwest
I have added this at the begining of index.php and it fixed it:
我在 index.php 的开头添加了它并修复了它:
ini_set('display_errors','Off');
error_reporting(E_ALL ^ E_DEPRECATED);
Thanks Aurelio De Rosa
感谢奥雷利奥·德·罗萨
回答by user2602967
I added the following in .htaccess file in joomla:
我在 joomla 的 .htaccess 文件中添加了以下内容:
php_value allow_call_time_pass_reference 1
php_value allow_call_time_pass_reference 1
and it worked like a charm. Thanks
它就像一个魅力。谢谢
回答by Zdenek Machek
You can try add to index.php
您可以尝试添加到 index.php
ini_set('allow_call_time_pass_reference', 1);
ini_set('allow_call_time_pass_reference', 1);
or to .htaccess
或 .htaccess
php_value allow_call_time_pass_reference 1
php_value allow_call_time_pass_reference 1
But it depends what is causing the problem and also server configuration if you are allowed to change php configuration.
但这取决于导致问题的原因以及服务器配置(如果您被允许更改 php 配置)。