


PHP simulation asp.net webFrom button submission event ideas and code_PHP tutorial
Since the company needs project development in PHP, and I have just started using PHP, in the process of writing button submissions, the button events in asp.net are better. First look at the code below,
require_once '../inc/EventHelper.php';
function Page_Load()
{
echo 'Will run at any time
';
if(!Page::IsPostBack())
{
echo 'Load product category
';
;
}
}
}
function bAdd_Click()
//Comm::CheckQX('Product Management_Add');
echo "bAdd_Click
";
}
function bEdit_Click()
//Comm::CheckQX('Product Management_Modification');
echo 'proID='.$_GET['proID'].'
echo "bEdit_Click
";
}
function sdfsdfdsf_Click()
echo "e44444444444444444444
";
}
?>
The above code runs the bAdd_Click function when the [Add] button is clicked (let’s call it that, function seems to mean function). Similarly, the bEdit_Click event is automatically run when the [Modify] button is clicked. There is no need for too many parameter changes or too many files. If the page function is not very complex, this mode can be used for rapid development.
Let’s take a look at the code of the EventHelper.php file:
class Page
{
//Whether to post data back, 1: Yes
public static function IsPostBack()
global $SYSRunEvent Name ;
return !empty($SYSRunEventName); $SYSRunEventName;
$arrEvent=get_defined_functions();
$arrEventUser=$arrEvent['user'];
$arr=array_keys($_POST);
foreach($arr as $row) break;
break; }
}
if(!empty($SYSRunEventName ))
exists('Page_Load'))
Page_Load();
strtolower($SYSRunEventName);
if(Page::IsPostBack())
> }
}
class Comm
{
public static function GetParam($params=array(),$cmd='addoverride')
{
$allParam=array();
if($cmd=='addoverride')
{
$arrKeys=array_keys($params);
foreach($arrKeys as $row)
{
if(!in_array($row,array_keys($allParam)))
$allParam[$row]=$params[$row];
}
}
else if($cmd=='del')
{
foreach($params as $row)
{
unset($_GET[$row]);
}
}
$arrKeys=array_keys($_GET);
foreach($arrKeys as $row)
{
if(!in_array($row,array_keys($allParam)))
$allParam[$row]=$_GET[$row];
}
$p='';
$arrKeys=array_keys($allParam);
foreach($arrKeys as $row)
{
$p.=$row.'='.$allParam[$row].'&';
}
return rtrim($p,'&');
}
}
Page::EventLoad();
?>
以上功能大家可以测试下,在我php5.4可以运行成功,不过在安全性方面还没考虑过多,看过一些文章php会有可能通过客户端执行php代码,因为php很许多实用的功能特性。
关于Comm::GetParam,由于经常需要获取get方式的参数,或修改参数,如分页时需要保留所有url参数,只修改分页参数(如page=5),所以就自行写了一些代码。
主要利用php以下几个特点:
function_exists
get_defined_functions
以及利用常用的表单提交原理,利用submit提交原理 实现功能的。
由于时间仓促,来不及说明具体原理,还请见谅,代码大家都可以看懂的。

The article discusses PHP, detailing its full form, main uses in web development, comparison with Python and Java, and its ease of learning for beginners.

PHP handles form data using $\_POST and $\_GET superglobals, with security ensured through validation, sanitization, and secure database interactions.

The article compares PHP and ASP.NET, focusing on their suitability for large-scale web applications, performance differences, and security features. Both are viable for large projects, but PHP is open-source and platform-independent, while ASP.NET,

PHP's case sensitivity varies: functions are insensitive, while variables and classes are sensitive. Best practices include consistent naming and using case-insensitive functions for comparisons.

The article discusses various methods for page redirection in PHP, focusing on the header() function and addressing common issues like "headers already sent" errors.

Article discusses type hinting in PHP, a feature for specifying expected data types in functions. Main issue is improving code quality and readability through type enforcement.

The article discusses PHP Data Objects (PDO), an extension for database access in PHP. It highlights PDO's role in enhancing security through prepared statements and its benefits over MySQLi, including database abstraction and better error handling.

Article discusses creating and securing PHP APIs, detailing steps from endpoint definition to performance optimization using frameworks like Laravel and best security practices.


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

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

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

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.

SublimeText3 English version
Recommended: Win version, supports code prompts!
