简体   繁体   中英

PHP display HTML Tags without Echo/Print

I've this code:

foreach($result as $i->$res)
{
    $link = "Company/" . str_replace(" ", "-", $view->result[$i]->node_title);

    $query = mysql_query("select * from url_alias where alias = '$link'");

    if(mysql_num_rows($query) > 0)
    {
        $result[$i]->node_title = "<a href = 'http://www.google.com'>asdf</a>";
    }
    else
    {
        $result[$i]->node_title = $result[$i]->node_title;
    }           
    $i++;
}

How can I dispaly anchor text as link without echo or print it? For now the anchor text just display as a plain text. Thanks in advance.

if your page is html file

then echo the link like this

   <a href = 'http://www.google.com'>asdf</a>

if your page is php then echo the link as you writed.

if your page is html then it will not work the link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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