dongxi5505 2011-04-08 05:11
浏览 64

如何在运行python的HTML文件中运行php?

I get an "unhandled exception" every time I try to run this standard include in an html file running python:

<?php
//add header with tabs
include('includes/templates/common/tpl_header.php');
?>

I'm trying to run it right under the body tag that looks like this:

<body py:match="body" py:attrs="h.append_class_attr(attrs, 'mcore-body')" py:with="
    attrs = h.attrs_to_dict(select('@*'));
    body_class = attrs.get('class', '').split(' ');
    advertising_banner_html = g.settings['advertising_banner_html'];
">

... sorry but I'm not the most avid programmer, how do you get that puppy to run?!

  • 写回答

2条回答 默认 最新

  • dsfs504545 2011-04-08 06:31
    关注

    HTML is HTML, Python is Python and PHP is PHP.
    It's THREE different technologies, which cannot be mixed.
    You can't "run standard PHP include" in HTML file.
    You can't "run standard PHP include" in Python file.
    You can run PHP code in PHP file only.

    You can't run Python code in HTML file. You can run Python code in Python file only.

    So, whole question makes no sense.

    It seems you should forget PHP while working with Python and use Python features for including files. Of course it shouldn't be PHP file, but Python or at least HTML file

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题