How can I add targets, in addition to a string

时间:2017-04-06 16:45:13

标签: php

I'm trying to add the target attribute to the following function, but with the tips go wrong, how can I do? This and education source

ch ($links as $link) {
        $output .= "<li><a href='http://localhost/player/index.php?var=" . $link['link'] . "'>" . $link['name'] . "</a><br/></li>\n " ;

I would need to add the target after the link, but with continuous quotes in receiving error

ch ($links as $link) {
    $output .= "<li><a href='http://localhost/player/index.php?var=" . $link['link'] . "'>target="principale"" . $link['name'] . "</a><br/></li>\n " ;

1 个答案:

答案 0 :(得分:0)

$output .= "<li><a href='http://localhost/player/index.php?var=" . $link['link'] . "' target='principale'>" . $link['name'] . "</a><br/></li>\n "

1) use single quotes to avoid your quoting issue

2) make sure the target attribute is inside the tag