简体   繁体   English

Drupal在体内显示PHP

[英]Drupal display php in body

I've made a page "test" and I want to place this code in the body 我做了一个页面“测试”,我想将此代码放在正文中

$name=db_result(db_query('SELECT NOW( )'); print $name; $ name = db_result(db_query('SELECT NOW()');打印$ name;

even though the input type is PHP it will not show up. 即使输入类型是PHP,也不会显示。

I tried a peice of example code I found and it worked fine 我尝试了一下发现的示例代码,并且效果很好

Hello
 <p>Welcome!</p>
    Today's date is: 
  <?php
 echo date('m/d/Y');
  ?>

What I ultimately want to accomplish is for all my php code to be able to display within the content body of the page 我最终要完成的工作是使我所有的php代码都能够显示在页面的内容主体中

Looks like your php code is missing a closing paren; 看起来您的php代码缺少结束符; try it with the same number of closing parentheses as opening (3): 尝试使用与开头(3)相同的结束括号数量:

$name=db_result(db_query('SELECT NOW( )')); print $name;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM