我有一个表单(如下),它在提交时运行几个 PHP 函数并生成一组 URL 及其状态,但是我无法从 $_POST 取回数组并试图将其保存为瞬态只给了我最后一行,有什么想法我哪里出错了吗?
Form code
echo "<form action=".admin_url('admin-post.php')." method='post'>";
echo "<input type='hidden' name='action' value='sisb_spider_start'>";
echo "<input type='submit' value='Run Link Checker'>";
echo "</form>";
echoing on admin-post.php
foreach($output as $url=>$result){
if($result=="1"){
echo "<p style='color:red'>".$url." is not responding, Please fix this and try again.</br></p>";
}
elseif($result=="2"){
echo "<p style='color:green'>".$url." is responding.</br></p>";
}
}
result from echoing on admin-post.php
http://sisb.test is responding.
http://sisb.test/page-2/ is responding.
http://sisb.test/ is responding.
http://sisb.test/nonexistant is not responding, Please fix this and try again.
http://sisb.test/sample-page is responding.
http://sisb.test/page-2 is responding.
http://sisb.test/wp-admin/ is responding.
http://sisb.test/hello-world/ is responding.
http://sisb.test/hello-world/#comment-1 is responding.
http://sisb.test/category/uncategorized/ is responding.
http://sisb.test/wp-login.php is responding.
http://sisb.test/feed/ is responding.
http://sisb.test/comments/feed/ is responding.