Home >Backend Development >PHP Tutorial >页面脚本 php 求教,该怎么处理
页面脚本 php 求教
function TrainHead($sdata,$edata){
$lastmin = (strtotime($edata["AllTime"])-strtotime($sdata["AllTime"]))/60;
$lasthour = (int)($lastmin / 60);
$lastmin %= 60;
$lasttime = $lasthour."???±".$lastmin."·???";
?>
……本人完全不懂脚本语言,但是数据库实验要求写页面,而且这星期就要交报告。这段网上找的代码也不知道哪里出错了,显示:
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 15
class=info train=
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 15
>
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 19
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 23
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 26-
Notice: Undefined variable: edata in C:\xampp\htdocs\showdata.php on line 26
Notice: Undefined variable: sdata in C:\xampp\htdocs\showdata.php on line 29
Notice: Undefined variable: edata in C:\xampp\htdocs\showdata.php on line 32
Notice: Undefined variable: lasttime in C:\xampp\htdocs\showdata.php on line 35
……
不懂啊,求大神帮忙啊,到底怎么改才对,谢谢啦~~~~
------解决思路----------------------
php都是这样的
------解决思路----------------------
看提示明显是变量没有定义。
function TrainHead($sdata,$edata){
调用这个方法时,没有传$sdata这个参数,可以检查调用这个方法的语句。