Passing variable to an include

爷,独闯天下 提交于 2019-12-11 08:41:48

问题


index.php

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

header.php

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

Output


回答1:


I think short tags may not be enabled. Try:

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

instead




回答2:


did you enable short tags in php.ini?

short link




回答3:


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

Try the following:

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



回答4:


You need to configure your PHP for short_open_tag



来源:https://stackoverflow.com/questions/5930466/passing-variable-to-an-include

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!