这里我将图片网址传递给服务器以获取图片。但我的路径是私有的,那么如何通过图像URL传递cookie以从服务器获取图像?
答案 0 :(得分: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.