如何调用php函数? [英] How to call a php function?

查看:105
本文介绍了如何调用php函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将这个函数调用到我的html页面,我希望表单出现?

how do I call this function to my html page I where I want the forms to appear?

<?php

function login_bar() {
  global $user;
  if ($user->uid == 0 ) {        
   $form = drupal_get_form('horizontal_login_block');
   return render($form);
  } else {
  // you can also integrate other module such as private message to show unread / read messages here
   return '<div id="loginbar"><p>' . t('Welcome back ') . ucwords($user->name) . '<p></div>';
  }
}

?>


推荐答案

在HTML页面的表单标签中

In form tag of your HTML page

<form type="post" action="test.php">

// test.php

// test.php

<?php
function login_bar() {
}

//如果要在某些按钮上调用该功能单击

// if you want to call the function on some button click

if(isset($_POST['submit']))
{
login_bar();
}
?>

这篇关于如何调用php函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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