PHP和Mysqlweb应用开发核心技术 第1部分 Php基础-1 开始了解php_php基础
1.1 第一个php
echo "Hello Everybody!";
?>
附加:phpinfo()函数的用法
1.2 输入php脚本
1.2.1 标示php代码段落
1.2.2语句和注释
/* */
//
#
#
1.2.3 php和html混合
1.3如何存储数据
1.4 输入php的基本数据类型
1.4.1 数字:(整数(int)和浮点数(float))八进制表示数字前必须加上 0(零),十六进制表示数字前必须加上 0x。
注意:1 浮点数运算时,只会取近似值
2 5/2=2.5 要想取整数用round()函数
1.4.2 字符串
单引号:' ' ,为了在字符串包含单引号,只需在它前面加上一个反斜线。
定义一个字符串 的最简单的方法是用单引号把它包围起来 (标点符号 ')。
想要输出一个单引号,需在它的前面加个反斜线 (\)。在单引号前或在字符串的结尾处想要输出反斜线,输入两条 (\\)
注意,如果在任何其它的字符前加了反斜线,反斜线将会被直接输出。
双引号" "
Escaped characters 转义字符 Meaning
\n 换行 (LF or 0x0A (10) in ASCII)
\r 回车 (CR or 0x0D (13) in ASCII)
\t 水平方向的 tab(HT or 0x09 (9) in ASCII)
\v 竖直方向的 tab (VT or 0x0B (11) in ASCII) (since PHP 5.2.5)
\f 换页 (FF or 0x0C (12) in ASCII) (since PHP 5.2.5)
\\ 反斜线
\$ 美金dollar标记
\" 双引号
\[0-7]{1,3} 符合该表达式顺序的字符串是一个八进制的字符
\x[0-9A-Fa-f]{1,2} 符合该表达式顺序的字符串是一个十六进制的字符
1.5一些在非常有用的函数
1.5.1 nl2br:在字符串每个新行(\n)之产插入html换行符
echo nl2br("foo isn't\n bar");
?>
1.5.2 var_dump:查看类型和变量值
1.5.3 print_r : 把结果返回到字符串,而不是把结果输出到输出流中。对于对象和数组,这种用户界面友好的输出特别有用处
print_r() 显示关于一个变量的易于理解的信息。如果给出的是 string、integer 或 float,将打印变量值本身。
如果给出的是 array,将会按照一定格式显示 键和元素。object 与数组类似。
1.5.4 var_export:它与var_dump类似,只不过它的输出实际上是所提供的数据值的有效的php代码表示
$arr=array(1,2,3,4);
var_exprot($arr);
?>

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

AI Hentai Generator
Generate AI Hentai for free.

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



Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

Alipay PHP...
