发送到Matomo报表端(相对于Matomo追踪客户端)的任何请求都会到达根目录的index.php。此文件会创建一个FrontController实例,并分发当前请求。
FrontController会分析请求中携带的参数module和action。如果action没有找到,就会使用默认index。然后Matomo会调用匹配的控制器方法。查找路径是
Piwik\Plugins\<module>\Controller::<action>
案例:
- module=MyPlugin&action=hello会调用:
- Piwik\Plugins\MyPlugin\Controller::hello()
- module=MyPlugin 会调用(没指定action,找默认index方法)
- Piwik\Plugins\MyPlugin\Controller::index()
控制器方法需要做一件事,那就是返回一个字符串响应(或任何可以被类型转换为字符串的对象)。这些字符串可以是HTML,JSON,….
最为一名插件开发人员,你可以按照自己的方式去返回。不过,一般的做法是先创建一个Matomo试图,然后从API获取数据,最后呈现视图,如下:
class Controller extends \Piwik\Plugin\Controller
{
public function index()
{
$view = new View("@MyPlugin\index.twig");
$view->data = \Piwik\Plugins\MyPlugin\API::getInstance()->getData();
return $view->render();
}
}
Your article helped me a lot, is there any more related content? Thanks!
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.com/lv/register?ref=B4EPR6J0
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.info/register?ref=IXBIAFVY
Thanks for sharing. I read many of your blog posts, cool, your blog is very good. https://www.binance.com/ru-UA/register?ref=JVDCDCK4
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.info/en-ZA/register-person?ref=B4EPR6J0
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://accounts.binance.info/ru-UA/register?ref=JVDCDCK4
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.info/ro/register?ref=HX1JLA6Z
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Your article helped me a lot, is there any more related content? Thanks!
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.com/join?ref=QCGZMHR6
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me. https://accounts.binance.com/zh-TC/register?ref=DCKLL1YD
Your article helped me a lot, is there any more related content? Thanks!
Your article helped me a lot, is there any more related content? Thanks!
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
976830 540498I likewise conceive so , perfectly written post! . 907853
336779 615529Its always excellent to learn suggestions like you share for weblog posting. As I just started posting comments for weblog and facing problem of lots of rejections. I feel your suggestion would be valuable for me. I will let you know if its work for me too. 221761
698984 978273You ought to take part in a contest for among the best blogs on the internet. I will suggest this internet website! 828557
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article. https://www.binance.info/lv/register?ref=SMUBFN5I
723536 106191Im not sure why but this weblog is loading extremely slow for me. Is anyone else having this issue or is it a difficulty on my finish? Ill check back later and see if the dilemma nonetheless exists. 20001
109160 121431excellent post. Neer knew this, thanks for letting me know. 748786
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
980903 860415Possible need all types of led tourdates with some other fancy car applications. Many also offer historic packs and other requires to order take into your lending center, and for a holiday in upstate New York. ??? 641116
Your article helped me a lot, is there any more related content? Thanks! https://accounts.binance.info/register/person?ref=QCGZMHR6
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.info/it/futures/ref?code=P9L9FQKY
125772 575907I appreciated than you may be now. 981790
392151 548706As I site possessor I believe the content material matter here is rattling fantastic , appreciate it for your efforts. You need to maintain it up forever! Greatest of luck. 194710