Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/247.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用包含变量的PHP脚本编写PHP文件_Php_File_Fwrite - Fatal编程技术网

使用包含变量的PHP脚本编写PHP文件

使用包含变量的PHP脚本编写PHP文件,php,file,fwrite,Php,File,Fwrite,我正在使用以下PHP代码编写一个PHP文件: 编写php文件的代码如下: **write.php** <?php $myfile = fopen("writePhp.php", "w") or die("Unable to open file!"); $txt = "<?php \n error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED);\n "; fwrite($myfile, $txt); $txtnew =

我正在使用以下PHP代码编写一个PHP文件: 编写php文件的代码如下:

**write.php**

<?php
$myfile = fopen("writePhp.php", "w") or die("Unable to open file!");
$txt = "<?php \n error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED);\n ";
fwrite($myfile, $txt);
$txtnew = "'$CALENDAR_DISPLAY = 'true';' \n";
fwrite($myfile, $txtnew);
?>

$txtnew='$CALENDAR\u DISPLAY=\'true\';'。“\n”。PHP用值替换双引号字符串中的变量。谢谢Bansi!成功了。我感谢你的时间和帮助。
<?php    
error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
    $CALENDAR_DISPLAY = 'true';
<?php 
error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
' = 'true';'