Maison > Article > développement back-end > php不支持属性值的问题
在改写主题时,遇到了比较烦的问题:
<code> <li><a class="active" href="#"></a></li></code>
PHP文件中插入了这个代码就会报错:
[16-Aug-2016 13:45:49 UTC] PHP Parse error: syntax error, unexpected 'active' (T_STRING), expecting ',' or ';' in /home/sunhbjaq/public_html/site/snippets/sidebar.php on line 17
当把class="active"去掉后就会恢复正常。
请问该如何解决?谢谢。(新手,请耐心回答,非常感谢!)
注:sidebar.php全文:
<code><!-- header --> <section id="header"> <header> <span class="image avatar"><img src="<?php%20echo%20html(%24site->authoravatarurl())%20?>" alt="<?php echo html($site->description()) ?>"></span> <h1 id="logo"><a href="<?php%20echo%20%24site->authorurl>"><?php echo html($site->author()) ?></a></h1> <p><?php echo html($site->authorintroduction()) ?></p> </header> <!-- /header 下面为id--> <nav> <ul> <?php foreach($pages->visible() as $p): ?> <?php if ($p->isOpen()): ?> <li><a class="active" href="#"></a></li> <?php else: ?> <li><a href="<?php%20echo%20html(%24p->url())%20?>"></a></li> <?php endif; ?> <?php endforeach ?> </ul> </nav> <footer> <ul class="icons"> <li><a href="#" class="icon fa-twitter"><span class="label">Twitter</span></a></li> <li><a href="#" class="icon fa-facebook"><span class="label">Facebook</span></a></li> <li><a href="#" class="icon fa-instagram"><span class="label">Instagram</span></a></li> <li><a href="#" class="icon fa-github"><span class="label">Github</span></a></li> <li><a href="#" class="icon fa-envelope"><span class="label">Email</span></a></li> </ul> </footer></section></code>
在改写主题时,遇到了比较烦的问题:
<code> <li><a class="active" href="#"></a></li></code>
PHP文件中插入了这个代码就会报错:
[16-Aug-2016 13:45:49 UTC] PHP Parse error: syntax error, unexpected 'active' (T_STRING), expecting ',' or ';' in /home/sunhbjaq/public_html/site/snippets/sidebar.php on line 17
当把class="active"去掉后就会恢复正常。
请问该如何解决?谢谢。(新手,请耐心回答,非常感谢!)
注:sidebar.php全文:
<code><!-- header --> <section id="header"> <header> <span class="image avatar"><img src="<?php%20echo%20html(%24site->authoravatarurl())%20?>" alt="<?php echo html($site->description()) ?>"></span> <h1 id="logo"><a href="<?php%20echo%20%24site->authorurl>"><?php echo html($site->author()) ?></a></h1> <p><?php echo html($site->authorintroduction()) ?></p> </header> <!-- /header 下面为id--> <nav> <ul> <?php foreach($pages->visible() as $p): ?> <?php if ($p->isOpen()): ?> <li><a class="active" href="#"></a></li> <?php else: ?> <li><a href="<?php%20echo%20html(%24p->url())%20?>"></a></li> <?php endif; ?> <?php endforeach ?> </ul> </nav> <footer> <ul class="icons"> <li><a href="#" class="icon fa-twitter"><span class="label">Twitter</span></a></li> <li><a href="#" class="icon fa-facebook"><span class="label">Facebook</span></a></li> <li><a href="#" class="icon fa-instagram"><span class="label">Instagram</span></a></li> <li><a href="#" class="icon fa-github"><span class="label">Github</span></a></li> <li><a href="#" class="icon fa-envelope"><span class="label">Email</span></a></li> </ul> </footer></section></code>
你这是语法错误,请上代码谢谢。