如何打印"";在php中,在html文件中可变


How to print "" in php varible in html file

好吧,当我这样做时:

<br>
$line9 = "<button onclick='window.location.href='//home-pc/';'/>GoBack</button>";
$phpfiletxt
"$line1'n$line2'n$line3'n$line4'n$line5'n$line6'n$line7'n$line8'n$line9'n$line10'n$line11'n$line12'n$line13'n$line14'n$line15";<br>
$myfile = fopen("$folder/index.html", "w") or die("Unable to open file!");<br>
fwrite($myfile, $phpfiletxt);<br>
fclose($myfile);<br>
$wordlink = "<a class='list' target='_top' href='$folder'>$word</a>";<br>
$myfile = fopen("wordslist.php", "a") or die("Unable to open file!");<br>
fwrite($myfile, $wordlink);<br>
header("Location: $folder");<br>

按钮在哪里,我想让它工作,因为它不会做任何事情,因为"或"放置不正确

所以我需要它,所以这是一个我可以打印的变量:

onclick='window.location.href='//home-pc/';'/>GoBack</button>";

转换为html文件。感谢

关于:

如何在php中打印"在html文件中可变

您可以执行以下操作:

$string = "The man said'"Hello'" and ran away!";
echo $string;

结果:那个男人说"你好"就跑了!

这叫做逃跑。http://php.net/manual/en/language.types.string.php

<button onclick="window.location.href='/home/pc'">GoBack</button>;

就是你需要用什么来代替它。

试试这个

$line9 = "<button onclick='"window.location.href='//home-pc/';'">GoBack</button>";

我总是用"代替",因为html有很多"需要像''"…''"一样转义">

$string = '<a class="text-success" id="success">success></a>'