[英]TYPO3 Extbase - How to call a controller action from external
Lets say I have an extension called my_extension
and in the my_extension a plugin called apiResponse
. 可以说我有一个扩展名为
my_extension
,在my_extension中有一个名为apiResponse
的插件。
Then I have in my controller a function called sendApiDataAction
. 然后我的控制器中有一个名为
sendApiDataAction
的函数。
How can I call this sendApiDataAction
from external via a usual http GET request? 如何通过通常的http GET请求从外部调用此
sendApiDataAction
?
First, you need these information from your extension: 首先,您需要从扩展程序中获取以下信息:
myExtension
) myExtension
) ext_localconf.php
where you assign the actions) ext_localconf.php
中定义操作的名称) sendApiData
- without the action
) sendApiData
-没有action
) tx_myextension_{pluginName}
tx_myextension_{pluginName}
Then, you can access the action by 然后,您可以通过以下方式访问操作
http(s)://your.domain.tld/index.php?id={pageId}&{namespace}[controller]={controllerName}&{namespace}[action]={actionName}
I assume you're using the same extension for calling the external plugin. 我假设您使用相同的扩展名来调用外部插件。 You can use fluid viewhelper to create URL for calling controller action.
您可以使用fluid viewhelper创建用于调用控制器操作的URL。
1) If you want to use URL for calling action use below Uri / ActionViewHelper . 1)如果要使用URL调用操作,请在Uri / ActionViewHelper下使用 。
<f:uri.action action="NULL" arguments="{foo: 'bar'}" controller="NULL" extensionName="NULL" pluginName="NULL" pageUid="123" pageType="123" noCache="1" noCacheHash="1" section="''" format="''" linkAccessRestrictedPages="1" additionalParams="{foo: 'bar'}" absolute="1" addQueryString="1" argumentsToBeExcludedFromQueryString="{foo: 'bar'}" addQueryStringMethod="NULL">
</f:uri.action>
You can use In-line notation. 您可以使用嵌入式符号。
{f:uri.action(action: 'NULL', arguments: {foo: 'bar'}, controller: 'NULL', extensionName: 'NULL', pluginName: 'NULL', pageUid: 123, pageType: 123, noCache: 1, noCacheHash: 1, section: '''', format: '''', linkAccessRestrictedPages: 1, additionalParams: {foo: 'bar'}, absolute: 1, addQueryString: 1, argumentsToBeExcludedFromQueryString: {foo: 'bar'}, addQueryStringMethod: 'NULL')}
2) Using Form : If you're submitting the form, you have a configuration for the form to calling the action. 2) 使用表单 :如果您要提交表单,则具有用于调用操作的表单配置。
<f:form additionalAttributes="{foo: 'bar'}" data="{foo: 'bar'}" action="NULL" arguments="{foo: 'bar'}" controller="NULL" extensionName="NULL" pluginName="NULL" pageUid="123" object="[mixed]" pageType="123" noCache="1" noCacheHash="1" section="''" format="''" additionalParams="{foo: 'bar'}" absolute="1" addQueryString="1" argumentsToBeExcludedFromQueryString="{foo: 'bar'}" fieldNamePrefix="NULL" actionUri="NULL" objectName="NULL" hiddenFieldClassName="NULL" enctype="NULL" method="NULL" name="NULL" onreset="NULL" onsubmit="NULL" class="NULL" dir="NULL" id="NULL" lang="NULL" style="NULL" title="NULL" accesskey="NULL" tabindex="123" onclick="NULL">
</f:form>
Hope this help you! 希望这对您有所帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.