創建一個PHP文件我試圖創建一個PHP文件並將其保存在根目錄,但它給錯誤,而這樣做使用PHP文件寫入
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\page\cjl\configAlter.php on line 181
這裏是我的代碼
<?php
$IndexFile = 'default.php';
$IndexCont = "<?php
session_start();
$currentBas = basename(dirname(__FILE__));
$parentBas = basename(dirname(dirname($_SERVER['SCRIPT_NAME'])));//Line 181
$DIR = __DIR__;
require('../../srcc/default.php');
?>";
//This is already define $parentDir."".$SubFolderjailorgname
$fileDirectoryR = $parentDir."".$SubFolderjailorgname;
$myReadfile = fopen($fileDirectoryR.'/'.$IndexFile, "w") or die("Failed to open file!");
fwrite($myReadfile, $IndexCont);
fclose($myReadfile);
//END CREATE TEXT TO FILE
?>
將雙引號替換爲單引號 –