In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to understand the PeachPie of the new PHP SDK + Runtime in .NET, which is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Preface
These days, I want to start my own blog based on .NET Core, so I searched the Internet for various blog engines and found these candidates: Blogifier, Miniblog and Moonglade written by edi.
Blogifier: this is an Angular SPA application at the front end, which is not good for SEO, and the loading speed of the first screen is slow, so it is excluded.
Miniblog: as the name implies, Mini can perfectly host content, but the theme is too simple to be customizable, so it is excluded.
Moonglade: the overall feeling is good, the interface is well designed, and the function is comprehensive, but SQL Server is required as a database. However, although SQL Server has a Linux version, it is also excluded due to host configuration and budget.
Isn't there a blog engine that suits my needs? The answer is, of course, yes.
It is well known that PHP is the best language in the world (funny), or it is well known that there is a blog engine called WordPress that is ecologically huge and built using PHP.
But what does PHP have to do with. Net?
PeachPie
PeachPie is a complete set of PHP SDK + Runtime built entirely on the .NET Standard, including compilers and runtimes, etc., compatible with PHP 5.4-7.4 (of course some features are still under development).
Official website: https://www.peachpie.io
So what are the advantages of PeachPie:
Open source: https://github.com/peachpiecompiler/peachpie
Cross-platform: because PeachPie is built entirely on .NET, it follows cross-platform, Windows, MacOS, Linux, etc., architecturally across x86, x86, 64, ARM, ARM64, and even MIPS, MIPS64, Risc-V and so on in the future.
Pure managed code: with the help of VS's powerful debugger and IDE experience, from development, debugging to testing, Profile is very cool.
Compilation: there is no compilation of PHP. This dynamically typed language faces the same problems as Python. It is almost impossible to find errors in the code at compile time, and it is difficult to diagnose type errors even if syntax errors are diagnosed with linter. On the other hand, PeachPie has a complete compiler suite to compile the PHP code into .NET Standard assemblies, which means that syntax and type checking are done at compile time, which ensures that the program will not crash because of code problems at run time, and that the source code is not needed for application distribution, which ensures the security of the source code.
Interoperability with .NET: PeachPie achieves the interoperability between PHP and .NET on the basis of retaining the original ecology of PHP. A PeachPie project can not only use the packages and plug-ins in the original ecology of PHP, but also enjoy the ecology of .NET.
Running on. Net: CLR/CoreCLR comes with proven JIT and GC, so assemblies compiled through PeachPie run on CLR/CoreCLR without any code changes. In php-bench, with the help of JIT on the CoreCLR platform, function call performance extends the original PHP by several orders of magnitude.
.net Foundation project: behind the .NET Foundation support, Walia high quality, guaranteed
But someone is about to ask, why don't I just use PHP but choose PeachPie curve to save the country?
Because I am willing, the rain girl has no melon (escape)
Start using #
The development environment of this article uses Visual Studio Code (you need to install the PeachPie plug-in). Of course, you can also use other development tools such as Visual Studio.
Install PeachPie's latest project template:
Copydotnet new-I Peachpie.Templates::*
Then three new project templates appear: Console Application, Class library, and ASP.NET Core Empty.
Let's look at the whole Console Application this time.
Copydotnet new console-lang PHP
Then write some code casually:
Copy
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: 223
*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.