search
Homephp教程PHP源码PHPer初涉asp.net的心得体验及两者对比[1]

<script>ec(2);</script>



搞不搞PHP不是我说了算,是公司说了算

玩不玩.NET也不是我说了算,同样是公司说了算

先前没碰PHP之前,我是用ASP的,后来03年时ASP.net很流行哈,就开始留意这方面的东西,还从http://www.mycodes.net下载了一本什么黄金版来看了看,特此声明,仅仅只是看看,为啥,哈哈哈,机子太慢,跑不动VS啊,而且当时边上的人又没有一个会.net的,所以也只是停留在理论阶段,仅仅知道了有HTML控件,有Server控件,有DataGirl什么的

但后来换工作后,跑去搞PHP了,当时也是公司要求,没办法,哈哈哈,关于PHP的,我写过了篇了,这里就不罗嗦了哈~网址在这里http://www.111cn.net/31721/viewspace_12952.html~

当我换了第四家公司时,他们是搞.net的,但是刚好有一个项目客户指名道姓要用PHP(客户怎么会有这种要求,怪了,更怪的是他要求项目用PHP,但环境却是WINDOS,估计客户那边有人在后面不懂装懂瞎指挥吧),所以我就进来了

没有一点悬念,第一个程序就是helloword,呵呵

我发现PHP和ASP.net有很多相似之处。真的,非常相似

MVC分离

PHP用smarty,而asp.net用同名再加一个.cs文件来代替,好比default.aspx就必定会有一个default.asp.cs文件一样

只不过,PHP是这样(指出这个程序文件的模板是哪个)
$tpl->display("default.htm");

而asp.net是这样(在我眼里他是反过来了,居然由模板来声明程序文件是哪个)



那么到底真的是这样吗?我不知道,我在asp.net也是刚入门,留在以后见分晓哈~

类库调用(用PHP的说法)

php用的是include先包含文件进来,然后再new实例化

而asp.net呢,他是直接用
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

的方式,其实我觉得也一样,至于不用指明调用哪个文件,那是因为那些命名空间里面的功能全都是由MS自已开发的,不似PHP这样由大众来提供类库或是框架什么的

打个比喻,asp.net里面的类库(水平差,估且这么叫吧,我也不知道叫啥,)其实都是MS自已做的,所以就像一母同胎的兄弟,相互之间不用废话就能共同协同使用

而php里面的类库,由社区不同的大从人群去完成,就好像一堆陌生人一样的,include就好比先打个招呼告诉人家说,我在这里,然后再实例化再使用

至于.net中为什么已经声明用system为什么还要再声明用了sys.web

按照我的经验,system里面是没有具体实现某种功能的代吗的,具体实现某种功能的代码是由他的子类web及子子类ui之类完成了,他的存在仿佛是为了理顺某种关系

唉,要上班了,今天先写这么多,过两天有啥心得体会了再写吧

———————无敌分割线————————————————————————————————

对了,还有点小困惑想咨询一下大家

html文件为纯粹由HTML标签组成的,但是MS的aspx文件中,他把所有的html标签转换成了MS自已的HTML控件或是Server控件,aspx.cs为后台代码

如此一来当美工把HTML文件给我时,
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software