我試圖用fopen和fwrite創建一個php文件,在php文件裏我想要的只是變量,而不是值本身。顯示變量不值,PHP
下面是我創建的PHP文件的方式,但它isn't顯示變量
$txt ="
<?php
require '../clases/class.db.php';
require '../clases/class.pagina.php';
$configura = new Pagina();
$nombre = $configura->rescata('web');
$vista = $configura->rescata('vista');
$numero = $configura->rescata('numero');
$secciones = $configura->secciones($numero,$i);
$social = $configura->social();
$carrusel = $configura->slider();
$noticias = $configura->noticias($vista,$i);
?>
<!DOCTYPE html>
<html>
<head>.....";
我的代碼只顯示例如「=新的Pagina();」 ,我想顯示「$ configura = new Pagina();」完全不是班級的價值或要求,當你訪問該頁面時,它會發生。
之後,我創建並保存到一個文件
$myfile = fopen($fichero, "w") or die("No puedo crear la web!!!"); fwrite($myfile, $txt);
fclose($myfile);
PHP替換它們的值的變量。將內容用單引號括起來或使用[nowdoc語法](http://php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc)。 – syck