我有 functions.php
while ($row_posts = mysqli_fetch_array($run_news)) {
$news_id = $row_posts['news_id'];
$user_id = $row_posts['user_id'];
$topic_id = $row_posts['topic_id'];
$news_title = $row_posts['news_title'];
$news_date = $row_posts['news_date'];
// getting the user who has posted the thread
$user = "select * from users where user_id ='$user_id' AND posts = 'yes'";
$run_user = mysqli_query($con, $user);
$row_user = mysqli_fetch_array($run_user);
$user_name = $row_user['user_name'];
$user_image = $row_user['user_image'];
另一个文件 showmap.php 我想让$ string动态来自用户
$string = 'Massive fire underneath Metro-North tracks in MODEL TOWN disrupts train service.';
$lower_string= strtolower($string);
答案 0 :(得分:0)
如果您尝试在同一请求中进行变量传输,则必须使用include()或require()之类的内容。
但是,如果文件重定向到另一个php文件并且您仍然希望变量可用,则可以将其保存在SESSION或COOKIE中。
在会话中写入的内容将在多个php页面中提供。
以下是有关使用会话的更多信息:http://www.w3schools.com/php/php_sessions.asp