开发者

Passing variable to an include

开发者 https://www.devze.com 2023-03-04 16:57 出处:网络
index.php <?php $title = \"This is the page title\"; require_once \'/includes/header.php\'; ?> header.php

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

精彩评论

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