在对ajax进行回显后,php代码会退出吗? [英] Will php code exit after echo for ajax?

查看:57
本文介绍了在对ajax进行回显后,php代码会退出吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个典型的由php引擎驱动的ajax网页.我使用echo从php代码返回一个html字符串.我的问题是,如果在回显后还有其他代码,这些代码是否会执行?还是echo的行为类似于exit,后者会立即返回并停止运行php代码?谢谢.

I am running a typical php-engined ajax webpage. I use echo to return a html string from the php code. My question is, if I have some other code after the echo, will those code get executed? Or echo behaves similar to exit, which immediately return and stop running the php code? Thanks.

推荐答案

否, echo 不会退出,通常在一个脚本中有多个回声. exit 确实接受了一个字符串参数将在退出前输出,因此,您可以执行以下操作:

No, echo in no way exits, you normally have more than one echo in a script. exit does take a string argument that it will output before exiting, however, so you can do:

exit("your string here");

它将输出字符串并退出

这篇关于在对ajax进行回显后,php代码会退出吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆