的問題是要改變全局變量的值,每次子叫,我怎麼能做到這一點如何讓靜態變量初始化爲全局變量
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