我遇到了一个问题,即我在外部php脚本中声明的变量不会显示在稍后由jquery加载的页面的一部分中。页面部分用jquery加载后运行php的问题
简化代码:
的index.php:
<?php
require_once "init.php";
?>
//the rest of the page is added here.
的init.php
<?php
$test = 'foo';
?>
home.php
<?php
echo $test;
?>
当点击一个div,jquery的将使用.load来添加'home.php'我进入页面。
问题在于$ test var没有显示,因为'init.php'没有在页面上运行'home.php'。有什么办法可以解决这个问题吗?
感谢
添加“include'init.php';”在home.php似乎不能解决问题。 – user1169601 2012-04-15 19:21:03