国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

PHP ?? ??

PHP ?? ??

PHP ?? ? ???

PHP??? ???? ??? ? ????. ?? ??? ??? ???? ?? ?? PHP ??? ?????.

include ? require ?? ?? ??? ??? ??? ??? ?? ??? ???? ? ?????.

?? ? ?? ??? ???? ??? ?? ??? ?? ????? ?????.

· ??? ???? ??(e_compile_error)? ???? ???? ??? ?????. ??? ??? ?.

· include? ??(E_WARNING)? ???? ??? ??? ??? ????? ?? ?????.

??? ??? ??? ??? ?? ???? ??? ????? ????? include? ?????. ??? ?? ?? ?????, CMS ?? ??? PHP ?????? ???????? ?? require? ???? ?? ??? ?? ? ??? ?????. ?? ??? ??? ??? ??? ?? ?????? ??? ???? ????? ? ??? ???.

??? ???? ?? ??? ?????. ?? ?? ? ???? ?? ?? ???, ??? ?? ?? ??? ?? ? ??? ?????. ?? ?? ??? ?????? ? ? ?? ?? ??? ?????? ???.

??

include 'filename';

??

require 'filename';


PHP include ? require ?

?? ?

"header.php"?? ?? ?? ??? ??? ?????. ????? ? ?? ??? ????? include/require? ?????.

<html>
<head>
<meta charset="utf-8">
<title> php中文網(wǎng) (php.cn)</title>
</head>
<body>
<?php include 'header.php'; ?>
<h1>歡迎來(lái)到我的主頁(yè)!</h1>
<p>一些文本。</p>
</body>
</html>

?? 2

?? ????? ???? ?? ?? ??? ??? ?????.

"menu.php":

echo '<a href="/">????</a>

<a href="/html " >HTML ????</a>

<a href="/php">PHP ????</a>';

????? ?? ???? ????? ???. ?? ?? . ???? ?? ??? ??? ????.

<html>
<head>
<meta charset="utf-8">
<title> php中文網(wǎng) (php.cn)</title>
</head>
<body>
<div class="leftmenu">
<?php include 'menu.php'; ?>
</div>
<h1>歡迎來(lái)到我的主頁(yè)!</h1>
<p>一些文本。</p>
</body>
</html>

? 3

??? ???? ?? ??("vars.php")? ??? ?????.

<?php
$color='red';
$car='BMW';
?>

??? ??? ??? ????. ??? ??? ????:

<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng) (php.cn)</title>
</head>
<body>
<h1>歡迎來(lái)到我的主頁(yè)!</h1>
<?php
include 'vars.php';
echo "I have a $color $car"; // I have a red BMW
?>
</body>
</html>

???? ?? ?? ??

include "foo.php";

? ???? ??? ???? ????. foo.php?? ?? ??? ???? ??? ?? ? ??? ?? ?? ???? ?????.

??: include(foo.php): failed to open stream: No such file ordirectory in /var/ www/web/ test.php ??? 3

??: include(): ???? ?? 'foo.php'? ?? ?????(include_path='.:/usr/local/php/lib/php'). /var/www /web/test.php 3?

?? ?? ??

include 'C: wampwwwfoo.php' ;

??? ?? ??? ???? include_path ??? ????? ????, ??? ?? ???? ???? D:wamp ?? E:www? ????? ??? ????

?? ????? C:wampwwwindex.php? ?? index.php?

include __DIR__ ?? ??? ? ????.

?? ????? ?? ??? ?? ??? ?????.

once

include? require? ?? ? ? ??? ?????.

include_once? require_once

? ???? ??? ????. ?? ??? ?? ??? ???? ????.

??? ??

include ?? require? ?? ??? ???? ? ????? ??? ?? ??? ??? ?? ????

<?php
$name = 'andy';
$age = 18;
?>
<h1><?=$name?>? <span><?=$age?></span></h1>

<?php
$name = 'andy';
$age = 18;
require "template.html";


return

PHP ??? ?? ??? ???? return ?

<?php? ??? ?? ????. $arr = include "return.php";? ?>

?>

PHP include_path

include(), require(), fopen_with_path() ??? ???? ??? ?? ?. include_path? ???? ?? ?? ? ??? ??? ? ? ????? ? ?? ?????? ?????. , ? PHP ??? ?? ??? include_path ??????

? ?????. 1.include_path

? ??

include(), require(), fopen_with_path() ??? ???? ??? ??? ?, include_path? ???? ?? ?? ??? ??? ??? ? ? ????? ? ?? ?????? ?????. include_path , ? PHP ??? ?? ??? include_path ?????? ?????.
??? cmd ??? ??? ? ?? cmd ??? ???? ???? ??? ?????. ?? ??? ???? ??? ??? ????? ???? ???? ?? ?????.

QQ圖片20161009144823.png

2.include_path ??

? ?? ??:
php.ini ??? include_path ??? ?????.
include_path = .:/usr/local/lib/php:./include
? ?? ??:
ini_set ??? ?????.
ini_set("include_path", ".:../:./include:../include");  
3. ??
zendframework?? index.php ??? ?????

??? ?? ??? ?????:

set_include_path('.' .PATH_SEPARATOR.'../library/'
.PATH_SEPARATOR.'./application/models/'
.PATH_SEPARATOR.'. / application/lib/'
.PATH_SEPARATOR.get_include_path());

PATH_SEPARATOR? Linux ?????? ":" ???? Windows??? ";"???.
??? ????? ??? ? ?? PATH_SEPARATOR ??? ???? ?? ?? ????. ??? ??? ???? Linux?? Win ????? ?? ? ??? ???? ??? ?????!
get_include_path? ?? ?? ?? ??? ?? ??? ????, ?? ??? ??? ?????.


???? ??
||
<html> <head> <meta charset="utf-8"> <title> php中文網(wǎng) (php.cn)</title> </head> <body> <div class="leftmenu"> <?php include 'menu.php'; ?> </div> <h1>歡迎來(lái)到我的主頁(yè)!</h1> <p>一些文本。</p> </body> </html>