从另一个不同目录的index.php调用index.php

时间:2014-12-22 06:42:04

标签: javascript php

/school
/teacher
  index.php
/student
  index.php

如何从student/index.php致电teacher/index.php

4 个答案:

答案 0 :(得分:0)

老师/ index.php中的

header("Location: ../student/index.php"); // this is incase you want to go to that page
require_once('../student/index.php'); // incase you want to include that file

答案 1 :(得分:0)

require '../student/index.php';

这将打电话给'剧本。如果脚本有返回值,那么只需在require语句的左侧创建赋值语句。

$ret = require '../student/index.php';

答案 2 :(得分:0)

teacher/index.php中使用此代码

header("Location: ../student/index.php");

答案 3 :(得分:0)

您还可以使用pecl_http(如果可用)和函数http_redirect。

http://php.net/manual/en/function.http-redirect.php