[英]How to properly add a PHP tag inside anchor link on PUG
<a href="http://<?php echo $link; ?>/thelink.php">thelink</a>
PUG compiles to:
<a href="http://<?php echo $link; ?>/thelink.php">thelink</a>
My problem are "<" and ">".
<a href="http://<?php echo $link; ?>/thelink.php">thelink</a>
I recommend using Phug when using Pug with PHP.我建议在将 Pug 与 PHP 一起使用时使用Phug 。
You can then use PHP variables (and objects) within PHP pretty easily.然后,您可以非常轻松地在 PHP 中使用 PHP 变量(和对象)。 See this example:
看这个例子:
// PHP
mixin link($href, $name)
a(href=$href)&attributes($attributes)= $name
+link('/foo', 'foo')(class="btn")
PHUG transforms this to: PHUG 将其转换为:
// HTML
<a class="btn" href="/foo">foo</a>
You can read more about this specific example in the documentation .您可以在文档中阅读有关此特定示例的更多信息。
Use "!"用 ”!” before "=" :
在“=”之前:
a(href!="http://<?php echo $link; ?>/thelink.php") thelink
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.