VisualStudio is used to develop the text setting method of PHP

  • 2020-03-31 21:06:42
  • OfStack

Now, ideas like three-tier, MVC, etc., are proliferating, separating the code from the HTML, and as the division of development and projects grow, a good IDE provides a lot of convenience for coding. Just like developing eclipse for Java and visual studio, developing PHP requires such a tool. Common PHP ides are Eclipse, NetBeans, Zend studio, vs. PHP, etc. I've used all of them, including Eclipse, NetBeans, and Zend studio, which are available in Windows and Linux. They all have integrated functions such as code awareness, debugging, design, and fragmentation. The main reason is speed. Vs is really fast. There are so many other ides out there, both in terms of startup speed and in terms of resource consumption, it's better than the other three. After all, it's Microsoft's own.



If you need to debug, you can edit the project property, here, there is a bad place is to Start page must be set, otherwise you cannot Start debugging, and press F5 to run debugging, is to open the Start page, like ASP.NET, to run the currently open page.

You can choose the mode you want to debug, or you can change the configuration of vs. PHP once and for all. PHP comes with an apache2.2 in the installation directory, so when you choose to debug, you can decide whether to use the built-in apache or the server apache, at the same time, the installation directory has PHP4,PHP5 directory, the things inside can also be modified to use, such as php.ini. If you use xdebug to debug, it is recommended to modify php5 under php-xdebug.ini, add modifications

Xdebug. Idekey = VSPHP
Xdebug.auto_trace = On
Xdebug. Collect_params = On     
Xdebug. Collect_return = On     
Xdebug. Trace_output_dir = "d: / x - debuginfo"
Xdebug. Profiler_enable = On      ; Turn on the performance monitor
Xdebug. Profiler_output_dir = "d: / x - debuginfo"      
Xdebug. Default_enable = On
Xdebug. Show_mem_delta = On


This will output debugging information to d:/x-debuginfo, and then use WinCacheGrind to see the CPU, memory usage, and function execution time of this execution, especially for performance optimization. Such as

The function annotations of PHP are stored in the Language Reference directory. Intellisense relies on these files. If you modify the annotation information, you can change the prompt of perception.


When it comes to code intellisense, vs. PHP gets an 80 out of 10, which can be frustrating. Of course, this may have something to do with distributing classes or functions in other files. Vs. PHP will automatically parse the include statements require,include, etc., and try to load the parse file. When using an instantiated object, when the current information is insufficient, it will try to load the file according to the Settings in the project configuration properties

S like the s in PHP.


In addition, well-written comments will provide great convenience for code-aware hinting, especially for custom class objects. For example,

Here's $this - > Response, he does not know what type it is, so there will be no prompt, but if the type declaration @var type is added, then the member information, prompt and so on of this object can be displayed normally

In breakpoint debugging, breakpoints are sometimes not captured, but they are implemented.


In fact, a lot of times, because this function is not reliable enough, in this case I still prefer to output variables.


Overall, I like vs. PHP better than zendstudio, NetBeans, etc. For speed and resource usage. In addition, I personally like to use ASP.NET pages with smarty syntax as PHP templates. Compared with pure HTML templates,.net pages have incomparable advantages in visualstudio, such as Masterpage and usercontroller, which can be displayed normally. Specific template class, when free to sort out the next.

If you're still using notepad, Dreamweaver or something, try vs.

Related articles: