• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php-PHP一个方法根据传递值怎么执行多次?

php 搞代码 4年前 (2022-01-25) 26次浏览 已收录 0个评论

phpjavascript数据

php代码

<code> function one($type='OfferGetAllOfferList',$start,$pagesize=10,$total=100)    {        $next=$start+1;        if($start*$pagesizeoutData['next'] = $next;            $this->outData['pagesize'] = $pagesize;            $this->outData['type'] = $type;            $this->outData['total'] = $total;            $this->output();        }        elseif($type == 'OfferGetAllOfferList' && $st<p>4本文¥来源gao!%daima.com搞$代*!码$网9</p><pre>搞代gaodaima码

art*$pagesize>$total) { $this->outData[‘next’] = $next; $this->outData[‘pagesize’] = $pagesize; $this->outData[‘type’] = ‘TradeOrderListGet’; $this->outData[‘total’] = $total; $this->output(); }elseif($type == ‘TradeOrderListGet’ && $start*$pagesize>$total) { $this->outData[‘next’] = $next; $this->outData[‘pagesize’] = $pagesize; $this->outData[‘type’] = ‘MemberGet’; $this->outData[‘total’] = $total; $this->output(); }else { echo “同步完成”; exit; } }


js代码

<code> <script>function init(){    $.ajax({url:"",async:false,success: function(text,result){        if(text == 2){            $.ligerDialog.open({                    height: 200,                    url: "",                    width: 300,                    name:'wintest4',                    title:'用户初始化',                    isResize:true,                    buttons: [ { text: '确认', onclick: function (item, dialog) {dialog.close();}                    },                    { text: '关闭', onclick: function (item, dialog) {dialog.close();}}                    ]                });        }else{            notifyWarn('用户数据已同步')        }    }});}function islogin(){    $.ajax({url:"",async:false,success: function(text,result){        if(text == 2){            $.ligerDialog.warning('该用户未初始化数据,是否进行初始化?', function (type)                {                if(type == 'yes'){                    init();                }            });        }        if(text == 1){            notifyWarn('用户数据已同步')        }        if(text == 3){        }    }});}$(function() {    islogin(); });</script></code>

问题:
$type默认是OfferGetAllOfferList,当$start*$pagesize大于100时执行elseif($type == ‘OfferGetAllOfferList’ && $start*$pagesize>$total)里面的代码,$start归1。
$start*$pagesize大于100时执行elseif($type == ‘TradeOrderListGet’ && $start*$pagesize>$total)里面的代码,结果归1。
最后输出“同步完成”。
遇到的问题就是第一个if执行完怎么把$start归1继续往底下执行?


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php-PHP一个方法根据传递值怎么执行多次?
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址