如何显示PHP&页面上的HTML源代码? [英] How to display PHP & HTML source code on a page?

查看:284
本文介绍了如何显示PHP&页面上的HTML源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在用户端显示PHP代码.像 w3School 这样吗?

How would one go about showing PHP code on user end. Sort of like w3School does?

让我们说一个灰色区域div,然后在其中显示代码而不激活它吗?

Having lets say a grey area div, and then showing the code in there without activating it?

推荐答案

您可以在html中使用html实体&lt;?php,它将被呈现为<?php

You can use html entities &lt;?php in the html it will be rendered as <?php

您可以使用 htmlspecialchars 来编码代码以使用html实体

You can use htmlspecialchars to encode your code to use html entities.

这篇关于如何显示PHP&amp;页面上的HTML源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆