[英]Visual studio code user snippets not working for php
As far as I know VSC won't pick up your php snippets even though your file might end in .php , what you have to do is insert manually <? php ... ?>
据我所知,即使您的文件可能以 .php 结尾,VSC 也不会获取您的 php 片段,您需要做的是手动插入
<? php ... ?>
<? php ... ?>
and afterwards your snippets should start work. <? php ... ?>
然后你的片段应该开始工作。
If you don't want to enter <? php ... ?>
如果不想输入
<? php ... ?>
<? php ... ?>
manually every time you can create a global snippet "Preferences-->User Snippets-->New Global Snippets File. Save the new file to something like "global.code-snippets" and then add your php snippet. Maybe something like that. <? php ... ?>
每次您可以手动创建全局代码段“首选项--> 用户代码段--> 新建全局代码段文件。将新文件保存到诸如“global.code-snippets”之类的内容,然后添加您的 php 代码段. 也许是这样的。
"php tag": {
"prefix": "php",
"body": [
"<?php",
" ${1:code}",
"?>"
],
"description": "php tag"}
Put it in the html
snippets file.把它放在
html
片段文件中。 It is what php
files use unless you are inside <?php ?>
tags.除非您在
<?php ?>
标签内,否则这是php
文件使用的内容。
Configuring Visual Studio Code for PHP development from here :从这里为 PHP 开发配置 Visual Studio Code:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.