0
即时通讯使用CakePHP做插件,所以我也apiController返回从数据库数据(更新).. 我打电话是函数为:的CakePHP不能在URL中读取令牌传递
$token = hash("sha256","appliTest".strtotime(date('Y-m-d')));
$date = strtotime(date('Y-m-d'));
$api_data = file_get_contents("http://local.mywebsite.com/appliTest/
api/getData?token=".$token);
,并在该函数的getData在apiController我这样做:
if((isset($this->params["url"]["token"]))
&&($this->params["url"]["token"]==hash("sha256","appliTest".strtotime(date('Y-m-d'))))){
die("ok");
}
感谢帮助...
感谢的回答,但问题还是一样的! – Fredj
问题可能存在于其他地方吗?也许运行CakePHP的Web服务器会剥离查询字符串,或者将代码放在错误的控制器中?可能是生成请求的代码部分中的URL不正确。 – Sevvlor
现在它的工作,我的意思是令牌存在,而不是nul,但内容不像其他时,我称之为功能! – Fredj