How to use visual studio to develop php settings _ php skills

Source: Internet
Author: User
Tags netbeans
In the early days when asp went viral, php and asp were mostly mixed with code in html. To be honest, IDE was not very useful at this time, but it was very easy to use a designer like dw. Nowadays, three layers of mvc and other ideas are everywhere, which separates code from html. In addition, with the development division of labor and the increase of projects, a good IDE can provide a lot of convenience for coding. Just like developing java with eclipse and. NET with visual studio, developing PHP also requires such a powerful tool. Common php IDEs include Eclipse, NetBeans, Zend studio, and vs. php. I have also used these tools. Eclipse, NetBeans, and Zend studio both have Windows and linux versions and integrate functions such as code awareness, debugging, design, and fragment, after a while, I found that in windows, I still feel like vsiual studio +. php is the best practice. The main reason is speed. The speed of vs is really fast. there are too many other IDEs. Both the startup speed and the consumption of resources in the use process are better than the other three. after all, it is Microsoft's own thing.

Vs. php is installed in the form of a plug-in to vs. now it has reached 2.9, supporting visual studio2005 ~ 2010. download and install it on the official website. By default, it is a 30-day trial and can be used with Visual Studio express. After installation, the php project will be added to the new project of visual studio.

Of course, one solution and multiple projects are also supported.

When vs. php is started, it will automatically scan the php files contained in the project and load them to the automatically aware code. At the same time, we do not want to load too many sensory support. by default, we do not load the perception support for infrequently used php extensions. if necessary, right-click the project and choose Add Php Module, select the extension to be added in the list ,. To Add awareness to files outside the project, right-click the project, select Add Php Refence, and select Add file support.

If debugging is required, you can edit the project properties. in this case, the Start page must be set. otherwise, debugging cannot be started. when you press F5 to run the debugging, this is the start page, and there is no way to open it like ASP.. NET.

You can select the debugging mode and other configurations as needed. of course, if you feel that some things are difficult to change, you can also modify the vs. php configuration once and for all. Vs. php contains an apache2.2 directory under the installation directory. Therefore, when debugging is selected, you can decide whether to use the built-in apache or the server apache. at the same time, the installation directory contains PHP4, PHP5 directory, which can be modified and used, such as php. ini. If you use xdebug for debugging, it is recommended to modify the php-xdebug.ini under php5, add modify under

[XDebug]
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; enable performance monitor
Xdebug. profiler_output_dir = "d:/x-debuginfo"
Xdebug. default_enable = On
Xdebug. show_mem_delta = On

In this way, the debugging information will be output to d:/x-debuginfo during debugging, and then use WinCacheGrind to view the CPU, memory usage, and function execution time of the execution, it is especially convenient for performance optimization. For example

The Language Reference directory stores php function annotations. smart sensing relies on these files to modify the annotation information in the file to change the prompt during perception. the prompt is in full English, I don't know if it will produce a Chinese comment. I'm looking forward to it.

In terms of code intelligent awareness, vs. php can only hit 80 points, and sometimes it is depressing to seek attention. Of course, this may be related to the distribution of classes or functions in other files,. php automatically parses include and require statements, and tries to load and parse the file. when the instantiated object is used, when the current information is insufficient, will try to load the file according to the settings in the project configuration properties

It is like _ autoload in php.

In addition, regular and reasonable comments will greatly facilitate code-aware prompts, especially for custom class objects. For example,

The $ this-> response here does not know what type it is, so no prompts will be available, but if the type declaration @ var type is added, the member information and prompts of the object can be displayed normally.

In terms of breakpoint debugging, although the breakpoint cannot be captured sometimes, it is also implemented.

In fact, many times, because this function is not reliable enough, I still prefer to output the variable to view it myself.

In general, I prefer vs. php, which is undoubtedly a better choice than zendstudio and NetBeans in terms of running speed and resource occupation. In addition, I personally like to use ASP.. NET page with the smarty syntax as the php template, compared to the pure html template ,. NET pages have unparalleled advantages in Visual Studio. for example, Masterpage and usercontroller can be displayed normally, which is quite convenient for control reuse and design. Specific template class. sort and release it when you are free.

If you are still using Notepad or Dreamweaver, try.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.