There is a session variable given the same name as some existing global variable (i.e. both $_SESSION['name']
and $name
exists).
Rename either of them.
It should be a quite duplicate question, as it just occurred to me.
문제
I am having a problem in the shortcut links from this site: http://smileshort.com/short-anonymous-links-api.html
Use api: http://smileshort.com/api.php?key=534287562&url=google.com
Show me this problem
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0
when i Use this function
<?php
function get_vgd($url)
{
$apiurl = "http://smileshort.com/api.php?key=890479270&url=$url";
$ch = curl_init();
$timeout = 3;
curl_setopt($ch,CURLOPT_URL,$apiurl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
echo get_vgd("http://www.google.com");
?>
해결책
There is a session variable given the same name as some existing global variable (i.e. both $_SESSION['name']
and $name
exists).
Rename either of them.
It should be a quite duplicate question, as it just occurred to me.
다른 팁
There can be another reason for this error. In case somebody else comes to this thread and knows that there is no duplicate variables.
If you do something like
unset($var);
$_SESSION['sessVar'] = $var;
you will get the same warning because you set an undefined variable to a session variable. The unset is usually not there, it was just for illustration purposes :)
I've just had this problem, and the reason for problem was
a variable called on the page was not defined.
It put me off track and got me quite concerned but now I've defined the $Var it no longer prints the Warning.