我如何调用PHP函数? [关闭]

问题描述 投票:-3回答:2

如何在要显示表单的HTML页面上调用此函数?

<?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 modules such as private
            // messages to show unread / read messages here.
            return '<div id="loginbar"><p>' .
                   t('Welcome back ') .
                   ucwords($user->name) .
                   '<p></div>';
        }
    }
?>
php function authentication drupal
2个回答
2
投票

在HTML页面的表单标签中

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

// test.php

<?php
function login_bar() {
}

//如果要在某个按钮上调用该函数,请单击

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

0
投票

HTML页面不会处理PHP调用。将页面更改为page.php,然后调用login_bar();

© www.soinside.com 2019 - 2024. All rights reserved.