search
Homephp教程php手册php 中的4种标记风格介绍

php 中的4种标记风格介绍

Jun 13, 2016 pm 12:00 PM
phponeintroducecodeDiscovernewbiemarkoflookforummistakestyle

今天看论坛的时候,看到一新手的错误代码,看了很久都没发现错误。我正纳闷呢?(这是为什么呢?)呵呵。
后来才发现标记问题,他使用的是短标记。而我的php.in配置里并没有开启它。哎惭愧呀!

1.xml风格(标准风格推荐使用)

复制代码 代码如下:


echo"这是xml风格的标记";
?>


xml风格的标记是常用的标记,也是推荐使用的标记,服务器不能禁用,该风格的标记在xml,xhtml中都可以使用。

2.脚本风格

复制代码 代码如下:





3.简短风格

复制代码 代码如下:




注:需要在php.ini中设置short _open_tag=on,默认是on,或者在 PHP 编译时加入了 –enable-short-tags 选项。(PHP 3版本还可以通过 short_tags() 函数激活使用短标记。)


4.asp风格

复制代码 代码如下:


echo'这是asp风格的标记';
%>



注:需要在 php.ini 配置文件中开启 asp_tags = on;

上面asp风格与简短风格需要在php.ini中设置下。默认是不支持的。

注: 对 ASP 风格标记的支持是 3.0.4 版添加的。

注: 在以下情况应避免使用短标记:开发需要发行的程序或者库,或者在用户不能控制的服务器上开发。因为目标服务器可能不支持短标记。为了代码的移植及发行,确保不要使用短标记。
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

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

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

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools