香雨站

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 103|回复: 0

面向菜鸟教程学习php

[复制链接]

2

主题

5

帖子

9

积分

新手上路

Rank: 1

积分
9
发表于 2023-1-12 13:42:03 | 显示全部楼层 |阅读模式
<?php$t=date("H");if ($t<"20"){    echo "Have a good day!";        echo $t;        echo "Hello world ";    echo "我要学 PHP!<br>";}                ?>
首先,已知<br>是空格的意思,echo输出语句只能在方法里,当然java中System也是如此/
date("H"); 表示时间,现在是16点,所以$t是 16
php中$t=date()函数参数意义及时间更改
PHP date() 函数 | 菜鸟教程 (runoob.com)
<br>在方法中 和方法外用法不一样的



方法里借助echo “<br>”才能是空格,<?php ?>外面直接<br>
接下来的任务是熟悉书本149页的内容。以及数组的内容。dreamweaver的表单
array_rand 函数是啥意思





其中 => 表示数组键名与元素的连接符。简单来说就是使用=>符号来分隔键和值,左侧表示键,右侧表示值。
表单建立,单选框,复选框,插入图片

07.[Dreamweaver]第7章 表单[上]_哔哩哔哩_bilibili
08.[Dreamweaver]第7章 表单[下]_哔哩哔哩_bilibili
php投票问题

<form id="form1" name="form1" method="post" action="">
  <table width="59%" border="1">
    <tr>
      <td width="34%"><input type="radio" name="radio" id="radio" value="中国" />        <label for="radio"></label></td>
      <td width="35%">中国</td>
      <td width="31%">  </td>
    </tr>
    <tr>
      <td height="81"><input type="radio" name="radio" id="radio2" value="日本" /></td>
      <td>日本</td>
      <td> </td>
    </tr>
    <tr>
      <td height="127"><input type="submit" name="button" id="button" value="提交" /></td>
      <td> </td>
      <td> </td>
    </tr>
  </table>
</form>
<?php
$file =fopen("./test.txt","r");
//获取file文件中的一行字符
$b = fgets($file);
//将文件中的字符0:0打散成数组,用$c接收
$c =explode(":",$b);
fclose($file);
if($_POST['button']=="提交")
{
        $a = $_POST['radio'];
        if($a =="中国")$c[0]++;
        if($a =="日本")$c[1]++;
        echo "目前中国 的投票 数".$c[0];
        echo "目前日本 的投票 数".$c[1]." ";
        //将数组缝合成字符串
        $d = implode(":",$c);
        echo $d;
        $file2=fopen("./test.txt","w");
        fwrite($file2,$d);
        fclose($file2);
        }
?>

点击中国


  php“天龙八部”问题,需要熟练掌握

小p打开phpmysql,需要将原来的mysql关闭。问题是现在在sel 界面,mysql查找不到想查的信息
mysql 增删改查语句
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|香雨站

GMT+8, 2025-3-15 14:57 , Processed in 0.280156 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.. 技术支持 by 巅峰设计

快速回复 返回顶部 返回列表