Blogger Information
Blog 34
fans 1
comment 0
visits 23085
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP基础1作业08-21
theYon的博客
Original
769 people have browsed it

PHP基础1

主要知识点

1)如果文档中只有php代码,必须将结束标签删除
2)echo print 
功能是将内容以字符串的形式输出到浏览器 
echo 直接输出无返回值 
print 输出成功并返回1 
3)
a.必须用 开始 后必须是字母或下划线,后面可以跟字母,不能有特殊字符 
c.严格区分大小写 
d.函数是不区分大小写

笔记

微信图片_20180822201906.jpg

微信图片_20180822201912.jpg


代码

<?php
header("Content-type: text/html; charset=utf-8");
$title = '94我';

echo $title;
$arr = [
    'name' => 'the',
    'grade' => 99,
    'city' => 'DG'
];

echo '<pre>'.print_r($arr,true);
echo '<br>';

$test = '我是字符串';
$test1 = $test.'en';
$test2 = '我\\是\\谁';
$test3 = '哈哈\\\'嘻嘻\'';
$test4 = '$test+yes';
$test5 = '{$test}+yes';
$test6 = "{$test},为什么呢";

echo $test,'<br>',$test1,'<br>',$test2,'<br>',$test3,'<br>',$test4,'<br>',$test5,'<br>';

echo  <<< "HEREDOC"
"$test6" \n  \r \t 
HEREDOC;


echo <<< 'NOWDOC'
{$test6} \n  \r \t
<p><a href="">Hello World</a></p>
NOWDOC;

echo <<<EOT
My name is "$test". {$arr['name']}
EOT;

运行结果

微信图片_20180822224400.png

总结

    通过课程学习,初次接触PHP,了解其基本规则以及用法,不过还得认真复习下今天的课程,消化该基础用法

Correction status:qualified

Teacher's comments:注意:heredoc和nowdoc与前面的<<<之间尽量不要留空格
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post