Home php教程 php手册 学习笔记PHP(2)

学习笔记PHP(2)

Jun 06, 2016 pm 07:40 PM
htmlspecialchars php study notes

8、htmlspecialchars() 定义和用法 htmlspecialchars() 函数把一些预定义的字符转换为 HTML 实体。 预定义的字符是: (和号) 成为 amp; (双引号) 成为 quot; ' (单引号) 成为 #039; (小于) 成为 lt; (大于) 成为 gt; 9、stripslashes() stripslash

8、htmlspecialchars()

定义和用法htmlspecialchars() 函数把一些预定义的字符转换为 HTML 实体。

预定义的字符是:

  • & (和号) 成为 &
  • " (双引号) 成为 "
  • ' (单引号) 成为 '

9、stripslashes() 

stripslashes() 函数删除由 addslashes() 函数添加的反斜杠。


10、addslashes() 

addslashes() 函数在指定的预定义字符前添加反斜杠。

这些预定义字符是:

  • 单引号 (')
  • 双引号 (")
  • 反斜杠 (\)
  • NULL

11、trim() 函数

trim() 函数从字符串的两端删除空白字符和其他预定义字符。


12、 get_magic_quotes_gpc()

magic_quotes_gpc函数在php中的作用是判断解析用户提示的数据,如包括有:post、get、cookie过来的数据增加转义字符“\”,以确保这些数据不会引起程序,特别是数据库语句因为特殊字符引起的污染而出现致命的错误。

在magic_quotes_gpc=On的情况下,如果输入的数据有单引号(’)、双引号(”)、反斜线()与 NUL(NULL 字符)等字符都会被加上反斜线。这些转义是必须的,如果这个选项为off,那么我们就必须调用addslashes这个函数来为字符串增加转义。


11、mysqli_fetch_assoc() 函数

mysqli_fetch_assoc() 函数从结果集中取得一行作为关联数组。

返回根据从结果集取得的行生成的关联数组,如果没有更多行,则返回 false。

Statement of this Website
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 Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

CakePHP Date and Time

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

CakePHP File upload

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

CakePHP Routing

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

CakePHP Project Configuration

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

Discuss CakePHP

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP Quick Guide

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

See all articles