在这里,我将图像 url 传递给服务器以获取图像。但是我的路径是私有的,所以我如何通过带有图像 URL 的 cookie 来从服务器获取图像?
问问题
96 次
1 回答
1
You can create cookies with using this command .
setcookie("user", "$value", time()+3600)
then get all the cookies in the variable like this
$cookiestring = '';
foreach ($_COOKIE as $key => $cookie) {
$cookiestring .= $key .'='. urlencode($cookie)
}
then create the $Header
$headers = array('Cookie' => $cookiestring);
then you can pass it like this
drupal_http_request($url, array('headers' => $headers));
I hope it works for you or you will get the little idea how to do it.
于 2014-01-03T10:27:09.817 回答