Zend Framework 使用 application.ini 中的配置的正确命名约定
我正在使用 Zend_Oauth_Consumer ,它需要传递许多配置值。目前我正在将一个数组传递到构造函数中,如下所示:
$config = array(
'callbackUrl' => 'http://www.domain.com/twitter/callback',
'siteUrl' => 'http://twitter.com/oauth',
'consumerKey' => 'XXXXXXXXXXXXXXXXXX',
'consumerSecret' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
);
$consumer = new Zend_Oauth_Consumer($config);
我不喜欢这种方法,因为这些配置现在位于控制器内,我希望它们像我的所有其他配置值一样位于 application.ini 中 - 我将如何解决这个问题?例如,是否有可遵循的命名约定?
I am using Zend_Oauth_Consumer which requires a number of config values to be passed. Currently i am passing an array into the constructor like so:
$config = array(
'callbackUrl' => 'http://www.domain.com/twitter/callback',
'siteUrl' => 'http://twitter.com/oauth',
'consumerKey' => 'XXXXXXXXXXXXXXXXXX',
'consumerSecret' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
);
$consumer = new Zend_Oauth_Consumer($config);
I dont like this approach as these configs are now within the controller and i would like them to be in application.ini like all my other configuration values - how would i go about this? is there a naming convention to follow for example?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的 application.ini 中你可以这样做:
在你的控制器中:
In your application.ini you can do this:
And in your controller: