来自PHP.NET的入门教程
PHP是一种创建动态网页的工具。嵌入PHP代码的网页就像普通的HTML文件一样,你可以使用任何你喜欢的编辑器对它进行编辑。本教程的所描述的对象是PHP 3.0 .
我需要什么? 在本教程中,我们假设你的服务器已经支持PHP,并且所有的文件都以.php3作为扩展名。在大部分服务器上,这是PHP文件的缺省扩展名,你可以向你的管理员确认一下。如果你的服务器支持PHP,这就足够了。很简单,建立你的PHP文件并且把它放到你的服务器上,那么服务器将会巧妙的对它进行处理。这不需要编译什么,也不需要安装什么额外的工具。你可以这样认为:PHP文件是加入了一组全新的巧妙的标签的普通HTML文件。
你的第一段PHP代码 上面这段代码的色彩只是给你一个视觉上的帮助,让你更容易理解PHP的标签及表达式的不同部分。请注意这不像CGI程序,不需要有可执行权限。你可以把PHP文件当作包含一组特殊标签的HTML文件,它可以做许多你感兴趣的事情。
这个程序是非常简单的,你无需专门为此建立一个WEB页面。它所做的就是显示: Hello World。
如果你试验过这段代码,但它却没有输出什么,问题可能是你的服务器不支持PHP。请询问你的管理员,确认一下。
前例的重点是向你介绍PHP的标签。用""标签结束。正如例中所示,在HTML文件中你可以自由地进入和退出PHP模式。
些有用的东西 让我们再来做点更有意义的事情。假如我们要来检查一下用户的浏览器是什么,可以检查浏览器发送给WEB服务器的用户代理(User Agent)字符串。这个信息存放在一个名为$HTTP_USER_AGNET的变量中,用下面的语句很简单地就可以显示出这个变量的值:
如果用户用的是Internet Explorer,那么显示的结果可能是: Mozilla/4.0 (compatible; MSIE 4.0; Windows 98) 实际上,用户的浏览器还传递许多其它的内容。用以下代码你就能得到这些变量的一个完整的列表:
把这段代码存进一个文件,比如叫info.php3,再把它上传到你的服务器上,用浏览器打开它,你会看到很多令你吃惊的东西。 你可以放置多个PHP语句在一组PHP标签中,也可以用一个代码块来做更多的事。例如:假如我们要检查一下浏览器是否为MSIE,可以用下面的这段代码:
{
echo "You are using Internet Explorer.
";
}
?> 这里我们将引入一些新的东西。 首先是“if”语句。如果你对于C语言的基本语法很熟悉,那么你就很容易看懂这段代码。如果不熟悉的话,建议找一些相关的书籍参考参考。PHP保留了C的简单语法,避免了C语言中难以控制的字符串和内存的处理。
第二,我们调用了一个函数:strstr()。strstr()是PHP内置的函数,用于在一个字符串中查找另外一个字符串,在例中我们在变量$HTTP_USER_AGENT中查找“MSIE”,如果找到字体串,那么该函数返回真值,即TRUE,否则反之。
下面我们再来看看如何进入和退出PHP模式,哪怕是在一个PHP代码块的中间:
if (strstr($HTTP_USER_AGENT,"MSIE")){
?>
}else{
?>
}?>
用跳出PHP模式直接输出HTML代码的方法,来代替使用echo语句输出结果。非常重要的是:不能破坏php代码逻辑上的完整性,运行这段代码显示的结果也许是:
You are using Internet Explorer
处理表单 PHP的另一个强大的地方在于处理html文件中的表单。需要理解这样一个基本概念,所有HTML文件表单的元素会自动的以相同的名字被传送到目标页面当中。这好像有点难以理解,我们通过下面的例子来阐述这一点:
这个表单只是包含了必须的HTML标签,并不完整。当用户填好了这张表单,并且按下“Submit”按钮,文件action.php3被调用了。假如说这个文件中包含下面的代码:
Hi . You are years old.
它执行的效果显而易见,因为变量$name和$age被PHP自动设置好了。
更多的? 这个教程可能会再扩充,目前就到此为止。
其它的教程请参考:
WebMonkey
DevShed
phpTidbits
PHPBuilder.com

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 world's leading ten digital currency apps include: 1. OKX, 2. Binance, 3. Huobi, 4. Matcha (MXC), 5. Bitget, 6. BitMEX, 7. Pionex, 8. Deribit, 9. Bybit, 10. Kraken. These platforms have their own characteristics in security, transaction services, technical architecture, risk control team, user experience and ecosystem.

Binance is the overlord of the global digital asset trading ecosystem, and its characteristics include: 1. The average daily trading volume exceeds $150 billion, supports 500 trading pairs, covering 98% of mainstream currencies; 2. The innovation matrix covers the derivatives market, Web3 layout and education system; 3. The technical advantages are millisecond matching engines, with peak processing volumes of 1.4 million transactions per second; 4. Compliance progress holds 15-country licenses and establishes compliant entities in Europe and the United States.

The top exchanges include: 1. Binance, the world's largest trading volume, supports 600 currencies, and the spot handling fee is 0.1%; 2. OKX, a balanced platform, supports 708 trading pairs, and the perpetual contract handling fee is 0.05%; 3. Gate.io, covers 2700 small currencies, and the spot handling fee is 0.1%-0.3%; 4. Coinbase, the US compliance benchmark, the spot handling fee is 0.5%; 5. Kraken, the top security, and regular reserve audit.

The charity party hosted by the Langley Community Health and Hospital Foundation raised $331,000 to establish the Guru Nanak Endowment Fund. The donation raised by the "Heart of Giving" charity party for Langley Memorial Hospital has reached one-third of its million-dollar target. On April 4, more than 250 guests attended the annual fundraising event at the Cloverdale Mirage Ballroom. Activities include raffle draws, silent auctions, live auctions and fundraising games, with 50/50 draws continuing until May 2. Since 2019, the Heart of Giving charity party has brought together donors every year to celebrate the community and raise donations, said Heather Scott, executive director of the Langley Community Health and Hospital Foundation. She said: "Testimation

Exchanges play a vital role in today's cryptocurrency market. They are not only platforms for investors to trade, but also important sources of market liquidity and price discovery. The world's largest virtual currency exchanges rank among the top ten, and these exchanges are not only far ahead in trading volume, but also have their own advantages in user experience, security and innovative services. Exchanges that top the list usually have a large user base and extensive market influence, and their trading volume and asset types are often difficult to reach by other exchanges.

The top ten leading virtual currency trading apps in the world in 2025 are: 1. Binance, 2. Gate.io, 3. OKX, 4. Huobi Global, 5. Bybit, 6. Kraken, 7. FTX, 8. KuCoin, 9. Coinbase, 10. Crypto.com.

In today's digital economy era, cryptocurrencies have become the focus of investors and traders. This article will introduce you in detail the ranking of the world's most popular digital currency trading platforms in 2025 to help you make wise choices. These platforms not only provide a variety of cryptocurrency trading pairs, but also have efficient trading systems and powerful security measures. Let's take a deeper understanding of the characteristics and advantages of these top trading platforms.

The top ten Apps of the 2024 currency trading platform are: 1. Binance, the world's largest trading volume, suitable for professional traders; 2. Gate.io, supports a wide range of digital assets and provides pledge services; 3. OKX, has many innovative functions, supports multi-chain trading; 4. Coinbase, has a friendly interface, suitable for beginners; 5. FTX, focuses on derivative trading, and provides low-cost tools; 6. Huobi, high liquidity, and global layout; 7. Crypto.com, comprehensive services, rich reward plans; 8. Bybit, derivative trading platform, suitable for high-frequency trading; 9. KuCoin, a new token initial platform, low fees; 10. Phem
