i include()
Benim functions.php
dosyasında takma ad var:
function render_template($template)
{
include($template);
}
ve basit template.html
:
Hello, <?php echo $name ?>
Ama ne yazık ki, takma ad fonksiyon bana bu çıktıyı verdi:
require 'functions.php';
$name = "world";
include('template.html'); // Hello, world
render_template('template.html'); // PHP Notice:Undefined variable: name
neden? ve nasıl düzeltebilirim?
teşekkürler.