简体   繁体   中英

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;

even though the input type is PHP it will not show up.

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

Looks like your php code is missing a closing paren; try it with the same number of closing parentheses as opening (3):

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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