Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何仅停止当前页面进程,而不是停止整个NodeJS服务器_Javascript_Php_Node.js_Die - Fatal编程技术网

Javascript 如何仅停止当前页面进程,而不是停止整个NodeJS服务器

Javascript 如何仅停止当前页面进程,而不是停止整个NodeJS服务器,javascript,php,node.js,die,Javascript,Php,Node.js,Die,这个问题听起来可能很笨拙,因为我不知道如何用语言来表达。请看一看这个例子: //PHP <?php die( "The PHP process stops here. The PHP is still running" ); insert_into_database_someinfo(); //This function will not be executed ?> 在PHP中,我认为这与“代码>回音”有一定的可比性,因为一切都在继续。我想输出信息,然后在那里停止

这个问题听起来可能很笨拙,因为我不知道如何用语言来表达。请看一看这个例子:

//PHP
<?php
    die( "The PHP process stops here. The PHP is still running" );
    insert_into_database_someinfo(); //This function will not be executed
?>
在PHP中,我认为这与“代码>回音”<代码>有一定的可比性,因为一切都在继续。我想输出信息,然后在那里停止进程(只是当前请求,而不是整个nodejs服务器)


请告知。

插入一个
返回
以停止执行您的函数:

if (nogood) {
    req.end( 'This is an output to the browser' );
    return;
}
insert_into_database_someinfo();

非常感谢您的快速回复。但是,它不会起作用(或者可能是我的错误)。我试着做
res.end('Email invalid');返回;将_插入_数据库_someinfo()并且它仍在运行。有趣的是,节点中没有等效项。
if (nogood) {
    req.end( 'This is an output to the browser' );
    return;
}
insert_into_database_someinfo();