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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵