简体   繁体   English

Visual Studio 代码用户片段不适用于 php

[英]Visual studio code user snippets not working for php

Visual studio code user snippets not working for php. Visual Studio 代码用户片段不适用于 php。 Have restarted VS code and the PC.已重新启动 VS 代码和 PC。 Still does not work.仍然不起作用。

User snippet code :用户片段代码

在此处输入图片说明

No snippet shows up :没有片段出现

在此处输入图片说明

Visual studio code version : Visual Studio 代码版本

在此处输入图片说明

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:

  • Download and install PHP Debug extension from Visual Studio marketplace.从 Visual Studio 市场下载并安装PHP 调试扩展
  • In VS Code command panel: press F1 > type 'install ext' and select 'Install Extensions'.在 VS Code 命令面板中:按F1 > 键入“install ext”并选择“Install Extensions”。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM