简体   繁体   English

如何通过 PHP 命令获取 PHP 脚本以重新启动/重新运行自身

[英]How to get a PHP script to restart/rerun itself via PHP command

Say I start a PHP script via command line.假设我通过命令行启动了 PHP 脚本。

Is there a way that PHP can restart/rerun the script from the top via a command inside the PHP script?有没有办法 PHP 可以通过 PHP 脚本中的命令从顶部重新启动/重新运行脚本?

<?php
if($something == 'yes')
{
 // restart/rerun whole PHP script
}
?>

As told in comment you can send header.如评论中所述,您可以发送 header。 or if you in the middle of page, you can add <script> tag with window.location.reload() there或者如果你在页面中间,你可以添加带有window.location.reload()<script>标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM