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
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 informer时间序列预测
  • ¥20 SSR引物多态性分析
  • ¥15 大漠插件在Win11易语言注册调用和免注册灵异事件,VS上注册调用完全没问题
  • ¥15 Addressable缓存机制做热更新的问题
  • ¥15 微信开发者工具vant组件
  • ¥15 iPhone iCloud云盘资料删除,MAC丢失50多G桌面资料
  • ¥20 希望各位学长可以给我答疑
  • ¥20 Linux实现: 客户端(cli01)通过TCP(或UDP)连接到聊天服务器(serv)进行聊天。
  • ¥15 (标签-matlab|关键词-m3)
  • ¥20 自制cifar10数据集,生成的batch缺少key:b