Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.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
can';不要使用php正确地编写文件_Php_Html - Fatal编程技术网

can';不要使用php正确地编写文件

can';不要使用php正确地编写文件,php,html,Php,Html,当我创建这个html文件时,我不能用双引号写“infofilediv”。如何转义这些字符?转义infofilediv和$before函数的双引号: <?php $CreateFile = fopen("allinfo.html","a") or die("unable to create file"); $up = "<div class="infofilediv">"; $fwri

当我创建这个html文件时,我不能用双引号写“infofilediv”。如何转义这些字符?

转义
infofilediv
和$before函数的双引号:

<?php
$CreateFile = fopen("allinfo.html","a") or die("unable to create file");
                        $up = "<div class="infofilediv">";
                        $fwrite($CreateFile,$up);
                        $fclose($CreateFile);
?>
$CreateFile=fopen(“allinfo.html”,“a”)或die(“无法创建文件”);
$up=“”;
fwrite($CreateFile,$up);
fclose($CreateFile);

您有两个问题首先是这里的双引号问题

$CreateFile = fopen("allinfo.html","a") or die("unable to create file");
                $up = "<div class=\"infofilediv\">";
                fwrite($CreateFile,$up);
                fclose($CreateFile);
取代

$fwrite($CreateFile,$up);
$fclose($CreateFile);
$use与变量一起使用

 fwrite($CreateFile,$up);
 fclose($CreateFile);

在双引号字符串中有双引号。您应该会得到一个PHP解析错误,这将帮助您识别问题;你不能逃避
。应该是
$up=”“;
或者在其中一个地方使用单引号。注意:未定义变量:在第80行的C:\xampp\htdocs\Mess\result.php中写入现在我能做什么?注意:未定义变量:在第80行的C:\xampp\htdocs\Mess\result.php中写入现在怎么办(您不能将$fwrite这样的函数与$v=“hello world”这样的变量一起使用,@mohade;这显然是我在复制/粘贴时的疏忽。)。
$up = "<div class=\"infofilediv\">"; 
$fwrite($CreateFile,$up);
$fclose($CreateFile);
 fwrite($CreateFile,$up);
 fclose($CreateFile);
$hello="hello world";