我想在我的应用程序中包含 Google API。我想将 Outh2 key 、 secret key 和开发人员 key 定义为常量,我可以在 App Controller 中调用和使用它们。
哪个是定义相同的最佳位置?
最佳答案
/app/Config/bootstrap.php
我不会将它们设置为常量,我会使用配置类来存储它们:
Configure::write(array(
'outh2.key'=>'foo',
'outh2.secret_key'=>'bar',
'outh2.dev_key'=>'baz'
));
$key = Configure::read('outh2.key');
关于php - CakePHP 定义常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10916727/