简体   繁体   English

从PHP到ASP.net/C#?

[英]From PHP to ASP.net/C#?

I know this may seem like a common question on SO but I could not really find anything in particular to my exact question. 我知道这在SO上似乎是一个常见问题,但我确实无法找到任何具体问题。

Just throwing some of my thoughts so far out there, PHP is super super easy and FAST to code in, I do not know C# or how to use ASP.net, I would like to learn it and studying some of it briefly it seems to me that it takes a lot more coding and time to code the same result in ASP.net 到目前为止,我只是想提出一些想法,PHP非常容易编写,而且编程起来非常快捷,我不知道C#或如何使用ASP.net,我想学习它并简要学习其中的一些内容,我认为,在ASP.net中对相同结果进行编码需要花费更多的编码和时间

So I am just curious is there any noticable benefits of having for example a social network in ASP.net vs having it in PHP? 所以我很好奇,例如在ASP.net中拥有社交网络与在PHP中拥有社交网络有什么明显的好处? Not looking for a debate but I need some guidance 不需要辩论,但我需要一些指导

Hopefully this is not to broad of a question, I couldn't really put it into words exactly how I wanted at the moment 希望这不是一个广泛的问题,我现在无法真正用我现在想要的语言来表达它

Anything you can do in C#/ASP.NET you can do in PHP and vice versa. 您可以在C#/ ASP.NET中进行的任何操作都可以在PHP中进行,反之亦然。

I would use the language that has the most support for the specific features you want your application to contain. 我将使用对您希望应用程序包含的特定功能最支持的语言。

EDIT: 编辑:

This also would mean to use the language that has the most support from the developers who will develop it. 这也意味着要使用将得到开发人员最多支持的语言。

I converted to ASP.NET C# around 2 years ago and never looked back! 大约2年前,我转换为ASP.NET C#,再也没有回头!

I love C# and ASP.NET ...For me it just allows me to get on with things, eg a gridview control to render result from the database without me having to manually construct it via table tags. 我喜欢C#和ASP.NET ...对我来说,它只允许我继续进行一些事情,例如使用gridview控件从数据库呈现结果,而无需通过表格标签手动构造它。

ASP.NET also has the repeater control should you wish to retain complete control over the output. 如果您希望保留对输出的完全控制,则ASP.NET也具有转发器控件。

My progression into ASP.NET would not of been as easy and straight forward if I didn't know PHP, PHP will always have a special place for me because it was my first web development language. 如果我不了解PHP,那么我进入ASP.NET的过程就不会那么简单直接,因为我是第一个Web开发语言,所以PHP始终对我来说占有特殊的位置。

So yes, I would say go for it... the way you build pages in ASP.NET is vastly different compared to PHP so don't get too confused by it all. 所以,是的,我想说的是...在ASP.NET中构建页面的方式与PHP相比有很大的不同,因此不要被这一切弄糊涂了。

PHP was a good language a few years ago. 几年前,PHP是一门好语言。 I don't know about PHP6, but PHP5 does not match out with the languages today, even scripting languages [like python]. 我不了解PHP6,但是PHP5不能与当今的语言相匹配,甚至不能与脚本语言[如python]相匹配。 I seriously suggest you should move on to C#/ASP [not necessarily .NET]. 我严重建议您应该继续使用C#/ ASP [不一定是.NET]。 Be extremely vary of using the .NET framework. .NET框架的使用千差万别。 The abstraction layer it sets up does not really come out as well given the fact that you'll be working with the Web: a system that hasn't evolved quite systematically [take browser compatibility for example]. 考虑到您将要使用Web:一个尚未完全系统地发展的系统(例如,与浏览器的兼容性),它设置的抽象层并没有真正发挥出来。 Although some may argue that such a framework will actually help out compatibility issues, Microsoft's stand [till now atleast] on the general 'open web' concept leaves many questions unanswered. 尽管有人可能认为这样的框架实际上可以解决兼容性问题,但微软对“开放式网络”概念的立场(到现在为止至少)仍然使许多问题没有得到解答。

If you decide to take a look at C#/ASP.NET, I strongly suggest considering the context for comparison. 如果您决定看一下C#/ ASP.NET,我强烈建议您考虑进行比较的上下文。 PHP is a scripting language, ASP.NET is a web application framework. PHP是一种脚本语言,ASP.NET是一个Web应用程序框架。 A better comparison between the two would be to put ASP.NET side to side with something like Symphony or CakePHP. 两者之间更好的比较是将ASP.NET与Symphony或CakePHP等并排放置。

Also, coming from the PHP world I think it's easier to get started with ASP.NET MVC, because there's less magic going on under the hood in that flavour. 另外,来自PHP世界,我认为更容易开始使用ASP.NET MVC,因为在这种情况下,幕后花絮更少。 It's very similar to CakePHP/Symphony in essence. 本质上,它与CakePHP / Symphony非常相似。 Also, you won't get annoyed with the shitty HTML output the older WebForms engine spits out ;-) 另外,您不会对老式WebForms引擎吐出的糟糕HTML输出感到恼火;-)

I think PHP is a fine language, but it tends to get a tangled old mess when the application grows. 我认为PHP是一种很好的语言,但是随着应用程序的增长,它往往会陷入混乱的局面。 Sure, you can overcome that by strict discipline, but that takes focus off of the real job at hand. 当然,您可以通过严格的纪律来克服这一点,但这会使焦点从手头的实际工作上移开。 In C#, things are a lot more strict. 在C#中,事情要严格得多。 Type safety is enforced (you cannot simply assign a floating point value to something that used to be a string, etc.), syntax errors turn up at compile time, opposed to at runtime in PHP. 强制执行类型安全性(不能简单地将浮点值分配给曾经是字符串的值,等等),语法错误在编译时出现,而不是在PHP的运行时出现。

TLDR: I say give it a go, especially the ASP.NET MVC variant. TLDR:我想尝试一下,特别是ASP.NET MVC变体。 If you don't like it, that's fine, there's loads of applications built in PHP that work like they're supposed to. 如果您不喜欢它,那很好,有许多用PHP内置的应用程序可以正常运行。 The least thing you could get from it is a bit of understanding of how other environments work :) 您至少可以从中获得对其他环境如何工作的一点了解:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM