php基础知识回顾

来源:互联网 发布:微店和淘宝哪个好做 编辑:程序博客网 时间:2024/05/29 23:25
<!DOCTYPE html><!--To change this license header, choose License Headers in Project Properties.To change this template file, choose Tools | Templatesand open the template in the editor.--><html>    <head>        <meta charset="UTF-8">        <title></title>    </head>    <body>        <?php        // put your code here        $a = 1;        $a += 2;        $a *= 3;        echo '<h1> the result is :'.$a.'</h1>';        $b = TRUE;        $c = FALSE;        echo '<h1>'.$b.'</h1>';        echo '<h1>'.$c.'</h1>';        echo '<h1>'.(1==1).'</h1>';        if(1==2)        {            echo '1等于2';        }        else {            echo '1不等于2';        }        echo '<br/>';        echo TRUE;        echo '<br/>';        echo FALSE;        for($i=1;$i<=10;$i++){            echo $i.'<br/>';        }        $arr = array("a" => "video", "b" => "course", "c" => "six");        $arr['a'] = "php100";        $arr['c'] = "sex";        //echo $arr;        foreach ($arr as $key => $value){            echo $key."=>".$value.'<br/>';        }        echo 'num = '.count($arr).'<br/>';        echo "IS ".  is_array($arr).'<br/>';        echo "Now Date : ".  date("Y-m-d").'<br/>';        echo 'secret : '.md5("php100")."<br/>";        $conn = mysql_connect("localhost", "root", "");        mysql_select_db("phptest",$conn);        mysql_query("set names 'GBK'");        $sql = "SELECT * FROM test";        $result = mysql_query($sql, $conn) or die(mysql_error());                for($i=0;$i<=mysql_num_rows($result);$i++)        {            $rowValue = mysql_fetch_row($result);            echo '<h1>'.$rowValue[0]." ".$rowValue[1]." ".$rowValue[2]." ".$rowValue[3]."</h1>";        }        mysql_close($conn);        $rf = fopen('doc.txt', 'r');        $content = fread($rf,  filesize('doc.txt'));        echo $content;        $content1 = file_get_contents('doc.txt' );        echo $content1;        ?>    </body></html>

结果输出:

 the result is :9111不等于2112345678910a=>php100b=>coursec=>sexnum = 3IS 1Now Date : 2015-03-18secret : b540d511f72d9914cd4bb620c95450611 zhangsan 2008-07-02 ѧ��2 lisi 2008-07-05 worker3 ���� 2008-07-05 stuent4 ���� 2015-03-18 teacherwelcome to study PHPwelcome to study PHP


0 0
原创粉丝点击