• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

Magento的执行流程?

php 搞代码 3年前 (2022-01-23) 16次浏览 已收录 0个评论

Magento的执行流程,一张图就可完全说明。

magento也是mvc模式的程序,但是与普通的mvc结构又有所差异。
我们通过它的一个注册来看他的程序执行流程:
首先,我们在地址栏输入http://localhost/magento/index.php/customer/account/create/来进入注册的页面。
step 1:程序拿到url中的customer会自动定位到模块 app/code/core/Mage/Customer
step 2:然后程序得到account会自动定位到控制器文件 app/code/core/Mage/Customer/controllers/AccountController.php
step 3:程序得到create,则会在刚刚找到的控制器文件中createAction()方法。

<code>public function createAction(){    if ($this->_getSession()->isLoggedIn()) {    $this->_<strong>*本文来源gaodai#ma#com搞@代~码^网+</strong><strong>搞代gaodaima码</strong>redirect('*/*');    return;    }    $this->loadLayout();    $this->_initLayoutMessages('customer/session');    $this->renderLayout();}</code>

step 4:执行程序装载目录 app/design/frontend/base/default/layout/下的customer.xml。然后寻找名为的标签

<code><label>Customer Account Registration Form</label><!---ecms  Mage_Customer --> page/1column.phtml<label>Form Fields Before</label></code>

step 5:在customer.xml中定义了要使用的block和template,相对应的文件目录分别为:app\code\core\Mage\Customer\Block\Form\Register.php 和app\design\frontend\base\default\template\customer\form\register.phtml
在template文件中可以使用$this来访问类的方法。
所以,magento的程序执行流程可以归纳为这样:
获得执行控制器->执行方法中处理业务逻辑和模型数据->控制器实例化布局对象->布局对象根据请求实例化block->block与template一一对应完成显示逻辑。

以上就介绍了Magento的执行流程?,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Magento的执行流程?
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址