doutenggu4070 2015-10-06 20:56
浏览 61
已采纳

php嵌入在html“ - >”中解释为标记

I want to embed this code into an html document:

<?php $sql="img_size=VERY_BIG"; $result = $conn->query($select.$sql); $result->num_rows; echo $result ?>

the problem is that i want it to be inside an option tag (of a select menu) so i typed it like this:<option value="VERY_BIG">500x500<?php $sql="img_size=VERY_BIG"; $result = $conn->query($select.$sql); $result->num_rows; echo $result ?></option>

PROBLEM: the -> is being interpreted as the end of the tag... I have no idea what im doing wrong

Greetings

  • 写回答

2条回答 默认 最新

  • doukao8851 2015-10-06 21:00
    关注

    You cannot just embed PHP in a HTML document.

    If you want it to be parsed as PHP, you need to rename it to have .php extension.

    There are actually alternative solutions for "parsing" html, but they are not recommended, since from there on, every HTML document has to 'go' through the interpreter, which can be a huge overhead.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀