我怎么可以定义重定向网址在yii框架为twitter oauth

fbcarpbf  于 2022-11-09  发布在  其他
关注(0)|答案(2)|浏览(129)

我已经在config.php中添加了API键和重定向URL

配置.php

<?php
     define('CONSUMER_KEY', 'my consumer key');
     define('CONSUMER_SECRET', 'my secrete key');
     define('OAUTH_CALLBACK', 'http://localhost:81/web/twitterAPI/process.php');
?>

但是重定向url不调用。
而且我也想在我的程序中添加外部PHP库文件。
我认为该文件是导入到main.php。
以及如何调用外部库文件。

nzrxty8p

nzrxty8p1#

你使用的是yii框架,这样你就可以在保护文件夹下的configmain.php文件中定义重定向url,比如,

'params'=>array('redirecturl'=>'[host][controller_name]/[method_name]',),

以及用于得到了

echo Yii::app()->params['redirecturl'];

我希望对这个代码有帮助...

kq4fsx7k

kq4fsx7k2#

您使用的是yii框架,
因此,您可以使用重定向URL,例如,[主机][控制器名称]/[方法名称]

<?php
     define('CONSUMER_KEY', 'my consumer key');
     define('CONSUMER_SECRET', 'my secrete key');
     define('OAUTH_CALLBACK', '[host][controller_name]/[method_name]');
?>

相关问题