我有以下代码:
$n = $totalMins/60;
$whole = floor($n);
$fraction = $n - $whole;
$totalHrs += $whole;
$totalMins = round($fraction*60);
$total = "$totalHrs hours and $totalMins mins";
$totalDeci = round($fraction, 2);
$totalDeci += $totalHrs;
$totalDeci = number_format($totalDeci, 2);
我希望在我拥有的另一个php页面上调用$ totalDeci。有没有办法让我称呼它?我对php并不熟悉。
答案 0 :(得分:0)
Page1.php:
<?php
session_start();
$_SESSION['your_variable'] = 'your_value';
?>
Page2.php:
<?php
session_start();
echo $_SESSION['your_variable'];
?>
Page2.php will show: your_value
希望它会对你有所帮助:)。
答案 1 :(得分:0)
使用如上例所示的会话或使用查询字符串
index.php?id=101
$user_id=$_GET['id'];
echo "$user_id";