我正在尝试使其$suggestion[$ss_count]
成为一个可点击的链接,$_POST
一旦点击它就会执行。我正在尝试实现查询扩展类的效果。这个词本身当然需要是发布的信息,它需要被识别为
if ($_POST['query'])
我用于此的代码是:
<?php
if ($_POST['query'])
{
$query = urlencode($_POST['query']);
$s_count = 0;
$ss_count = 0;
$query = 'http://www.dictionaryapi.com/api/v1/references/collegiate/xml/'.$query.'? key=135a6187-af83-4e85-85c1-1a28db11d5da';
$xml = new SimpleXMLIterator(file_get_contents($query));
foreach ($xml -> suggestion as $suggestion[$s_count])
{
$s_count++;
}
if ($s_count > 1)
{
echo ('<h4>Did you mean?</h4>');
while ($ss_count <=$s_count)
{
echo ($suggestion[$ss_count].'<br>');
$ss_count++;
}
}
}
?>