PHP笔记(一)PHP基本知识
<h1 style="color: black; text-align: left; margin-bottom: 10px;">创建PHP程序</h1>PHP代码框架<span style="color: black;"><? php
></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2.文件命名规则</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">只<span style="color: black;">包括</span>小写字母、数字以及破折号。禁止<span style="color: black;">运用</span>空格以及其它特殊字符。文件扩展名应该是.php。</p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">创建用于Web浏览器的输出</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">PHP程序<span style="color: black;">能够</span>执行三种基本类型的操作。</p>从用户<span style="color: black;">得到</span>数据执行计算并<span style="color: black;">拜访</span>和操作存储再文件和数据库中的数据。<span style="color: black;">表示</span>数据,以便用户能看见它<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">echo语句</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">能够</span>向web浏览器发送输出,<span style="color: black;">这般</span>用户就<span style="color: black;">能够</span>查看它。</p><span style="color: black;">echo</span>(<span style="color: black;">"输出语句"</span>);<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">能够</span>用来<span style="color: black;">包含</span>用来围绕HTML标记的字符<>以及HTML标记对关闭部分的字符/。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">PHP注释</strong></p><span style="color: black;">// 在<span style="color: black;">这儿</span>写下你的注释(两个斜线<span style="color: black;">起始</span>注释,后面跟一个空格,可跟任意字符)</span>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">PHP<span style="color: black;">构成</span>部分</h1>数和字符串<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">PHP有两种数:整数和双精度数。双精度数又<span style="color: black;">叫作</span>浮点数。整数范围限制为-2147483648~2147483647(<span style="color: black;">包含</span>它们)。双精度数<span style="color: black;">运用</span>标准的IEEE-64格式来存储,<span style="color: black;">准许</span>存储最大约为1.8*10^308的双精度数,<span style="color: black;">供给</span>的精度约为14个小数位数或有效数字。</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">字符串<span style="color: black;">能够</span><span style="color: black;">包括</span>任意字符,可用来存储<span style="color: black;">位置</span>、名<span style="color: black;">叫作</span>等不进行计算的数据。指定字符串必须<span style="color: black;">运用</span>双引号。想要在字符串中<span style="color: black;">包含</span>反斜线等特殊字符,应当<span style="color: black;">运用</span>适当的转义序列</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">转义序列</strong></p>
<div style="color: black; text-align: left; margin-bottom: 10px;">
<div style="color: black; text-align: left; margin-bottom: 10px;">
<div style="color: black; text-align: left; margin-bottom: 10px;">
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">\n</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">换行</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">\r</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">回车</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">\t</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">横表</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">\\</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">反斜线</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">\$</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">货币符号</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">\"</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">双引号</p>
</div>
</div>
</div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">2.PHP变量</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">合法的变量名:①以一个$符号<span style="color: black;">起始</span>,②在¥后面跟一个字母<span style="color: black;">或</span>下划线_,③添加<span style="color: black;">更加多</span>字母、数字<span style="color: black;">或</span>下划线。</p><span style="color: black;">$length</span> = 10;<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">3.标量和数组</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">创建一个数组,为数组指定一个值和一个关键字。</p><span style="color: black;">$class</span> = <span style="color: black;">"math"</span>;<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关键字不必是数字,<span style="color: black;">能够</span>如下定义:</p>$preference[<span style="color: black;">"Jan"</span>] = <span style="color: black;">"strawberry"</span>;<span style="color: black;">//</span>定义jan的<span style="color: black;">爱好</span>
$preference_of_Jan =$ preference[<span style="color: black;">"Jan"</span>];<span style="color: black;">//</span>获取jan的<span style="color: black;">爱好</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">4.操作符和函数</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">操作符</strong></p>
<div style="color: black; text-align: left; margin-bottom: 10px;">
<div style="color: black; text-align: left; margin-bottom: 10px;">
<div style="color: black; text-align: left; margin-bottom: 10px;">
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">+</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">相加</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">-</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">相减</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">*</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">相乘</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">/</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">相除</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">%</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">取模</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">++</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">加一</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><<--</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">减一</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">.</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">连接</p>
</div>
</div>
</div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><strong style="color: blue;">函数</strong></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">包含</span><span style="color: black;">有些</span>执行有用计算的函数</p>
<div style="color: black; text-align: left; margin-bottom: 10px;">
<div style="color: black; text-align: left; margin-bottom: 10px;">
<div style="color: black; text-align: left; margin-bottom: 10px;">
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">abs(x)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回x得绝对值</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">ceil(x)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回x得四舍五入整数</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">floor(x)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回值x得向下取整值</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">max(x,y,...)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回一组值得最大值</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">min(x,y,...)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回一组值得最小值</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">pow(x,n)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回数字x的n次幂</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">strftime(f)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回当前日期</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">sqrt(x)</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">返回x的平方根</p>
</div>
</div>
</div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">想要</span>正确地<span style="color: black;">运用</span>一个函数必须<span style="color: black;">晓得</span>的的点:</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">函数名;函数功能和返回值;函数<span style="color: black;">需求</span>多少个参数;<span style="color: black;">每一个</span>参数的含义</p>
这篇文章真的让我受益匪浅,外链发布感谢分享! 感谢你的精彩评论,为我的思绪打开了新的窗口。
页:
[1]