php中return和exit的区别
来源:互联网 发布:mac air 换电池多少钱 编辑:程序博客网 时间:2024/05/14 01:59
php中return和exit的区别
exit 是停止程序运行,不输出内容return 是返回值,跳出函数,但不停止程序运行补充 一下, exit 后面 加个 () 也是可以输出内容的!return 是返回,也有终止程序的作用。php 遇到,return 即不运行 后面代码。但终止有本质区别!楼上的说的很好,举个例子吧function test(){ echo 'test1'; return; echo 'test2';}echo 'test3';//-----------------------function test_1(){ echo 'test1'; exit; echo 'test2';}echo 'test3';前者输出:test1test3,为什么不输出test2因为在一个函数里遇到return 他就返回了,不再执行函数内的代码,但是函数外的代码仍然会执行。第二个只输出:test1,当脚本遇到exit;整个脚本都不再执行了,不管是函数外的还是函数内的。
0 0
- php中return和exit的区别
- php中exit、die和return的区别
- php中die(),exit(),return的区别
- php中return exit() die()的区别
- php中die(),exit(),return的区别
- Oracle 中Return 和exit的区别
- c中exit和return的区别
- Exit() 和 Return() 的区别
- exit()和return()的区别
- return和exit的区别
- return和 exit的区别
- exit()和return()的区别
- exit和return的区别
- return和exit的区别
- exit()和return的区别
- exit和return的区别
- return 和 exit 的区别
- return和exit的区别
- 物流配送系统
- iOS开发支付集成之银联支付
- Cocos2dx 3.0 过渡篇(二十六)C++11多线程std::thread的简单使用
- loadrunner ——Abnormal termination, caused by mdrv process termination
- Android studio--Android开发添加外来字体库
- php中return和exit的区别
- android tv焦点特效实现浅析
- 湖北一企业来了傻员工,改变了所有聪明的员工!
- Java 中的中文编码问题
- es 学习 3 DSL 总结
- 【9307】&【a303】过河卒(NOIP2002)
- 漫谈Google的Native Client(NaCl)技术
- 【无线基础】RTS/CTS
- iOS开发支付集成之支付宝支付