In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to develop the PHP site running in ASP.Net. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
The .net Core ecosystem is becoming more and more powerful as the open source community continues to inject into it, and interesting projects emerge from time to time, such as Peachpie, which makes it possible to migrate PHP code to .net Core projects.
You can more easily understand its features by creating a simple starter.
First install the template for Peachpie:
Dotnet new-I Peachpie.Templates::*
Then create the project:
Dotnet new web-lang PHP-o helloPHP
Then change the directory to Server folder to run the program:
Cd Serverdotnet run
Finally, visit http://localhost:5004/ through the browser:
The running mechanism of Peachpie is very simple, compiling PHP files into dll files on .net platform, so that they can be called by other programs like ordinary .net code libraries.
It consists of three parts:
Compiler (peach.exe or Peachpie.NET.Sdk) that compiles PHP files into .net assemblies
Runtime (Peachpie.Runtime.dll), which provides the functionality required by the program at run time
Code base (Peachpie.Library.dll), containing functions, classes, and other implementations of PHP
Going back to the initial starter code, you can find that the key point is in the Website.msbuildproj file in the Website directory:
Library netstandard2.0 helloPHP
Under the action of both Peachpie.Compiler.Tools and Peachpie.NET.Sdk, all PHP files, including index.php files, will eventually be compiled into a dll file.
It is also easy to use this dll file, which is called in the Configure method of the Startup class:
App.UsePhp (new PhpRequestOptions (scriptAssemblyName: "helloPHP"))
PHP sites running in ASP.Net are born.
The Peachpie project as a whole is still under development, but it does not affect its ability to do some amazing work. For example, its official website, although built on WordPress, has been compiled by Peachpie to run in ASP.NET. Based on the following picture, you wouldn't have thought that this site was written by PHP:
The above is the editor for you to share how to develop PHP sites running in ASP.Net, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.