开发者

Passing variable to an include

index.php

<?php
    $title = "This is the page title";
    require_once '/includes/header.php';
?>

header.php

<head>
    <title><?= $title ?></title>
</head>

Ou开发者_运维问答tput

Passing variable to an include


I think short tags may not be enabled. Try:

<title><?php echo $title ?></title>

instead


did you enable short tags in php.ini?

short link


My only thought is that you have short tags disabled in your php.ini.

Try the following:

<head>
    <title><?php echo $title; ?></title>
</head>


You need to configure your PHP for short_open_tag

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜