nasıl ben php kullanarak yeni bir html sayfası içine html biçimlendirme ekleyebilirim?

2 Cevap php

I have a php script that uses a $content variable to write text to a newly created html page that is empty. my php script works great using regular ascii text. when i try to insert html markup tags i get an error and script stops working. here is an example. the html write doesn't work no matter what html tags i use. $Content = "echo ""; echo ""; echo "require_once('some.php')"; echo "Hello, today is "; echo date('l, F jS, Y'); echo ""; echo "";\r\n";

Ben yankılanan ve yankılamamasını denedim. i delimeter bir tür eklemek veya ben bu soruna alabilirsiniz kullanarak gereken php işlevi vardır gerekiyor?

2 Cevap

Biraz daha prezentabl kodunuzu yapma ...

$Content = "echo "";
echo "";
echo "require_once('some.php')";
echo "Hello, today is ";
echo date('l, F jS, Y');
echo "";
echo "";\r\n";

Reveals a parse error at the very beginning. $Content = "echo ""; contains an extra quotation mark (") which the interpreter won't be happy about. It looks like you're trying to assign all your php code to a variable, which is probably not what you are trying to accomplish.

Bu umuyoruz ki daha olası görünüyor ...

require_once('some.php');
echo "Hello, today is ";
echo date('l, F jS, Y');
echo "\r\n";
echo "<!-- Added by Richard for kicks -->";

Tekrar deneyin ve bir tarayıcı üzerinden komut ziyaret ettiğinizde, Görünüm-> Kaynak gidin ve her şeyi PHP komut yankılanırken olduğunu görmelisiniz.

Eğer HTML sayfası için çıkış bilgi isterseniz:

echo "<b>This is bold</b> This isn't";

Doğru biçimi olacaktır. Ben açıkçası deftere parçacıkları kırık bir kaç şeyler yaptığını görmek ama gerçekten yapmak için çalışıyoruz ne hiçbir fikrim yok.

Neden bunu çıktısı önce bir değişken içinde içerik koyarak? Eğer $ içeriğindeki tüm içerik varsa, kullanmak için biçim olacaktır

echo $content;

Deftere Belki gerçek komut birisi daha yardım olabilir.