用Php模拟asp.net的页面模型
用php模拟asp.net是不大可能的,特别是对于php这样的对面向对象支持不完整的动态语言来讲,更是很大的困难.在这些说模拟是说可以由这个例子来理解asp.net的运行机制(又说深了,他仅仅是一个模以而以) .代码很简单,无需细说,本测试在win2000,iis5,php 4.4.0上运行通过
page.php
/*********************************************
*Sinoprise Function Classes
*CopyRight(c):2006 Sinoprise Technology Lab
*
*Unit Name: page.php
*func:
*Crate:Shuguang Yin 2006-07-15
*********************************************/
class SFC_Page
{
//环境变量
/*var $Server;
var $Session;
var $QueryString;
var $Post;
var $Cookie;
var $Files;
var $Env;*/
//页面控制属性
var $EnableViewState;
//页面属性
var $CharSet;//页面字符集
var $PageTitle;//页面的标题
var $PageStyle;//页面的风格
function SFC_Page()
{
/*if (strcmp(substr(PHP_VERSION,0,1),4)>=0){
$Server = $_SERVER;
$Session = $_SESSION;
$QueryString = $_GET;
$Post = $_POST;
$Cookie = $_COOKIE;
$Files = $_FILES;
$Env = $_ENV;
}else{
global $HTTP_SERVER_VARS,$HTTP_GET_VARS,$HTTP_POST_VARS,$HTTP_COOKIE_VARS,$HTTP_POST_FILES ;
global $HTTP_ENV_VARS,$HTTP_SESSION_VARS;
$Server = $HTTP_SERVER_VARS;
$Session = $HTTP_SESSION_VARS;
$QueryString = $HTTP_GET_VARS;
$Post = $HTTP_POST_VARS;
$Cookie = $HTTP_COOKIE_VARS;
$Files = $HTTP_POST_FILES;
$Env = $HTTP_ENV_VARS;
}*/
$this->EnableViewState = false;
}
//发生在服务器状态还原之前
function PageInit()
{
}
//发生在服务器状态还原之后,但在服务器端事件之前
function PageLoad()
{
}
//发生在激发服务器端事件之后,但在生成任何东西之前
function PagePreRender()
{
}
//发生在生成页面之时
function PageRender()
{
}
//发生在网页生成完成之后
function PageUnLoad()
{
}
//显示输出
function Display()
{
$this->PageInit();
if ($this->EnableViewState){
$this->DeCodeViewState();
}
$this->PageLoad();
$this->PagePreRender();
echo "
echo "";
echo "PageStyle.">";
echo "";
$this->PageUnLoad();
}
//判断是第一次打开还是post
function IsPostBack()
{
}
//对ViewState进行编码
function EnCodeViewState()
{
echo " echo "Value=\"".base64_encode(serialize($this))."\"";
echo ">";
}
//对ViewState进行解码
function DeCodeViewState()
{
if (isset($_POST['SFC_ViewState'])){
$this = unserialize(base64_decode($_POST['SFC_ViewState']));
}
}
}
?>
页面文件,php.php
require_once('page.php');
class PhpTest extends SFC_Page
{
var $conut;
function PhpTest()
{
}
//发生在服务器状态还原之前
function PageInit()
{
}
//发生在服务器状态还原之后,但在服务器端事件之前
function PageLoad()
{
}
//发生在激发服务器端事件之后,但在生成任何东西之前
function PagePreRender()
{
}
//发生在生成页面之时
function PageRender()
{
echo ++$this->conut;
//echo serialize($this);
echo "
";
echo "";
}
//发生在网页生成完成之后
function PageUnLoad()
{
}
}
$cls = new PhpTest();
$cls->CharSet="gb2312";
$cls->PageTitle="页面的标题";
$cls->EnableViewState=true;
$cls->Display();
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The message "Your organization has asked you to change your PIN" will appear on the login screen. This happens when the PIN expiration limit is reached on a computer using organization-based account settings, where they have control over personal devices. However, if you set up Windows using a personal account, the error message should ideally not appear. Although this is not always the case. Most users who encounter errors report using their personal accounts. Why does my organization ask me to change my PIN on Windows 11? It's possible that your account is associated with an organization, and your primary approach should be to verify this. Contacting your domain administrator can help! Additionally, misconfigured local policy settings or incorrect registry keys can cause errors. Right now

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

HTTP status code 520 means that the server encountered an unknown error while processing the request and cannot provide more specific information. Used to indicate that an unknown error occurred when the server was processing the request, which may be caused by server configuration problems, network problems, or other unknown reasons. This is usually caused by server configuration issues, network issues, server overload, or coding errors. If you encounter a status code 520 error, it is best to contact the website administrator or technical support team for more information and assistance.

In iOS 17, Apple introduced several new privacy and security features to its mobile operating system, one of which is the ability to require two-step authentication for private browsing tabs in Safari. Here's how it works and how to turn it off. On an iPhone or iPad running iOS 17 or iPadOS 17, Apple's browser now requires Face ID/Touch ID authentication or a passcode if you have any Private Browsing tab open in Safari and then exit the session or app to access them again. In other words, if someone gets their hands on your iPhone or iPad while it's unlocked, they still won't be able to view your privacy without knowing your passcode

The famous activation script MAS2.2 version supports digital activation again. The method originated from @asdcorp and the team. The MAS author calls it HWID2. Download gatherosstate.exe (not original, modified) from https://github.com/massgravel/Microsoft-Activation-Scripts, run it with parameters, and generate GenuineTicket.xml. First take a look at the original method: gatherosstate.exePfn=xxxxxxx;DownlevelGenuineState=1 and then compare with the latest method: gatheros

HTTP status code 403 means that the server rejected the client's request. The solution to http status code 403 is: 1. Check the authentication credentials. If the server requires authentication, ensure that the correct credentials are provided; 2. Check the IP address restrictions. If the server has restricted the IP address, ensure that the client's IP address is restricted. Whitelisted or not blacklisted; 3. Check the file permission settings. If the 403 status code is related to the permission settings of the file or directory, ensure that the client has sufficient permissions to access these files or directories, etc.

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's
