dsfh40613182 2018-07-20 03:18
浏览 108
已采纳

什么是`{$ smarty.server.PHP_SELF}?action = bulkdomain`在smarty模板中意味着什么?

I am reading a smarty project code, there is a .tpl file, and in it there is a form, its action is {$smarty.server.PHP_SELF}?action=bulkdomain:

<form method="post" action="{$smarty.server.PHP_SELF}?action=bulkdomain">
...

what is this mean?

Does it means submit this request to the .tpl's corresponding .php file? but how about the .php file the function like? because the php code is close sourced, I can not get it.


EDIT-01

I mean, in the template, use the action="{$smarty.server.PHP_SELF}?action=bulkdomain" for assigning the request method.

how about the request method should be in the template corresponding php file?

should it like this?

<?php

function bulkdomain($params)
{
    ...
}

EDIT-02

In the current running php file:

<?php

require($_SERVER['DOCUMENT_ROOT'] . '/smartyHeader.php');
$smarty->registerPlugin('block' ,'hsp', 'test1');

$smarty->assign('foo', 'Foo');

$smarty->display('php/test.tpl');

if there submit the data, whether I will write the code in the php file like this?

<?php

require($_SERVER['DOCUMENT_ROOT'] . '/smartyHeader.php');
$smarty->registerPlugin('block' ,'hsp', 'test1');

$smarty->assign('foo', 'Foo');

$smarty->display('php/test.tpl');

// accept the code
$action =$_GET['action']

whether I accept the action like upper writing code?

  • 写回答

1条回答 默认 最新

  • duanrenzou1619 2018-07-20 06:22
    关注

    $smarty.server.PHP_SELF is the same as $_SERVER['PHP_SELF'] variable - means name of PHP file that currently running.

    If you want to process you form which have action="{$smarty.server.PHP_SELF}?action=bulkdomain" you can just check if exists global $_GET variable with key "action" and value "bulkdomain", for example:

    if(isset($_GET['action']) && $_GET['action']=='bulkdomain') {
        // do smt
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog