Use Visual Studio to develop php image and text settings

Source: Internet
Author: User
Tags php template netbeans

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.