Возвращение ассоциативного массива из admin-post. php - PullRequest
0 голосов
/ 08 апреля 2020

У меня есть форма (ниже), которая запускает пару 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.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...