的问题是要改变全局变量的值,每次子叫,我怎么能做到这一点如何让静态变量初始化为全局变量
function sub()
{
static $x=global $present;
static $y=global $max;
static $z=global $min;
if($x==$z)
{
$x=$y;
}
$x--;
return $x;
}
sub();
sub();
sub();
我曾经尝试这样做太
function sub()
{
global $present;
global $max;
global $min;
if($present==$min)
{
$present=$max;
}
$present--;
return $present;
}
sub();//it works only once
sub();
sub();
,请提供给我的解决方案,这样我可以改变全局变量每次调用函数的值.......谢谢
子的主要功能是检索值FRM数据基地,但仍然SRC相同,无论多少次,我呼叫改变功能,请帮我出
function sub()
{
global $present;
global $max;
global $min;
if($present==$min)
{
$present=$max;
}
else
--$present;
return $present;
}
<script>
function change()
{
alert("hello");
var x=document.getElementById("show");
x.src='<?php
if($con==true)
{
$cmd="select * from showcase where item_no=".sub();
if($res=$con->query($cmd))
{
if($res->num_rows>0)
{
while($rw=$res->fetch_array())
{
echo "$rw[1]";
}
}
else
{
echo "no record found";
}
}
else
{
echo "query problem";
}}
?>';
alert(x.src);
}
</script>
你有没有听说过[indentation](http://en.wikipedia.org/wiki/Indentation)? –
没有让你对不起? – user2558479
@Maerlyn我已经把实际使用...现在除了我的qustn请现在看到 – user2558479