以编程方式设置php.ini值 [英] Set php.ini values programmatically

查看:159
本文介绍了以编程方式设置php.ini值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在PHP中设置 php.ini 值?最佳范围有限?

Is it possible to set php.ini values from within PHP? Optimally with a limited scope?

背景:我想强制允许 short_open_tag c $ c> include 命令以便于内容写作者的作业。实际的PHP Web应用程序在整个使用长标签(一开始和结束,真的),但对于内容文件,我想启用更方便的快捷方式。

Background: I want to force-allow short_open_tag for the duration of an include command to facilitate content writers’ jobs. The actual PHP web application uses long tags throughout (well, one at the beginning and one at the end, really) but for the content files I’d like to enable the more convenient shortcuts.

然后通过输出缓冲和 require 的组合来呈现内容文件,并且其结果用于填充视图特定的模板。 (我知道模板引擎,如Smarty,但我不想在这里使用它们。)

The content files are then rendered by a combination of output buffering and require, and the result of this is used to fill out a view-specific template. (I know about template engines such as Smarty but I don’t want to use them here.)

php.ini 文档不知道如何查询/设置配置值。

The php.ini documentation unfortunately doesn’t tell how to query/set the configuration values.

推荐答案

ini_set 执行作业?

string ini_set ( string $varname , string $newvalue )

还有 ini_get 查询配置。

这篇关于以编程方式设置php.ini值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆