PHP inspection reports CSS selector unused. It is used by a PHP echoed Tag

允我心安 提交于 2020-01-06 10:38:50

问题


I have PHP code which creates an HTML

echo('<div id="keyboard">');

In my CSS I have

#keyboard {
}

PHPStorm reports the CSS selector is not used. It is used. Can I make it realize that? In not, I once saw some way of disabling a single error or warning, but I can no longer find that in the documentation.


回答1:


What you can try is to move the html out of the php script and just open the parentheses when needed. I suspect that the IDE cannot distiguish between php echoed html and html outside of php tags.

<?php
 //add php code here
?>
<div id="keyboard">
<?php
 //php code here
?>
</div>
<?php
 //add php code here
?>

The IDE should now be able to match the CSS with the relavant id.



来源:https://stackoverflow.com/questions/12067382/php-inspection-reports-css-selector-unused-it-is-used-by-a-php-echoed-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!