ここにあるリンクのセットを解析してソートしたいのは例です
フォームコード
<form name="frm" method="post" action="test.php">
<textarea id="url" name="url"></textarea>
<input type="Submit" name="Submit" value="Submit"/>
</form>
そして私は1行ごとに次のリンクを送信します
http://www.google.com/moo
http://www.yahoo.com/boo
http://www.google.com/zee
http://www.bing.com/kee
http://www.yahoo.com/foo
これは2 on google
and2 on yahoo
と1 on bing
linksです
コードは次のtest.php
ようになります(フォームが送信を送信する場合)
<?PHP
$url=$_POST['url'];
$url=nl2br($url);
$url=explode("<br />",$url);
foreach ($url as $value ){
$encrypt = md5($value);
echo $encrypt . "<br>";
}
?>
出力は次のようになります
8ec5ec689ab94e5df9d89cea624e7e5e //google.com/moo
b165a8209254d205a2950f23214125ec //yahoo.com/boo
fc8d853005d21a7fc8abb06aba0756fb //google.com/zee
f691aab0c39f288f503ae61d3cc3b5b4 //bing.com/kee
8f55ee4d5227f87ec1316e0fa6c61e3b //yahoo.com/foo
今私の質問
ホストを解析してどちらがオンになっているかを確認しgoogle,yahoo and bing
、並べ替えて、次のように結果を正確に表示したいと思います。
google.com // parsed and sorted
fc8d853005d21a7fc8abb06aba0756fb //google.com/zee
8ec5ec689ab94e5df9d89cea624e7e5e //google.com/moo
yahoo.com // parsed and sorted
b165a8209254d205a2950f23214125ec //yahoo.com/boo
8f55ee4d5227f87ec1316e0fa6c61e3b //yahoo.com/foo
bing.com // parsed and sorted
f691aab0c39f288f503ae61d3cc3b5b4 //bing.com/kee
つまり、ホスト上でリンクを並べ替えてから、解析されたホストの下で各グループを並べ替えた結果を表示したいということです。
たくさん作る必要があると思いますforeach
!!
それを行う方法のアイデア〜ありがとう