webdevask.com

Menu

  • Home
  • New
  • Add question

php - HTML being displayed as text

View Original

When I load the following code using php...

<?php <h1>Some text</h1> ?>

the tags are printed as text -

<h1>Some text</h1>

Any ideas?

Found the answer - see my answer.

Answer

Solution:

You need to output the actual HTML code if you are placing any HTML code within PHP.

You can achieve this using .

<?php
    echo("<h1>Some text</h1>");
?>

Answer

Solution:

<h1><?php Some text ?></h1>

why dont you try this.

Answer

Solution:

You must print it in order for it to appear the way you want it to

<?php echo"<h1>Some text</h1>" ?>

like this

Answer

Solution:

Found the issue, the content-type was set as json.

Answer

Solution:

<?php echo "<h1>Some text</h1>"; ?>
<?php echo "<h1>Some text</h1>"; ?>

if you want to show a variable

<?php
$_varTest=2;
echo "<h1>Show variable {$_varTest}</h1>"; ?>

Source

See also:

  • php สร้าง Google ชีตจากบัญชีบริการ

  • php - Laravel 8.0 Installation Failed

  • javascript - How to include HTML data (tags) as value in "arrayToDataTable" of Google Pie Chart?

  • how to Grouping array in php

  • php - vender folder from my laravel project has more 1k error

© 2021
E-mail: contact@webdevask.com
Back to top