递归调用有关问题
Jun 13, 2016 pm 01:40 PM
递归调用问题,在线等
- PHP code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
有这样一个函数,递归调用的,同时里面又有循环,可是递归之后,应该是由于$v被重新赋值的原因吧,循环就不再进行了。麻烦问高手们怎么解决?
------解决方案--------------------
试试加一句 reset($reply_arr)在循环前,
另外你那个$layer又在参数里(但是调用没用到),又global了,好像有点不妥
------解决方案--------------------
你把 show_child($v['pid']); 拿到if外面试试
------解决方案--------------------
你的意思是在第五层停止继续进行递归是不是?
如果是的话可以这么实现。
如果是我理解错了,就当我没有来过这里。
- PHP code
1 2 3 4 5 6 7 8 9 10 11 |
|
- PHP code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

Simplified HTTP Response Mocking in Laravel Tests

Build a React App With a Laravel Back End: Part 2, React

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon
