第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

php框架之Magento的執(zhí)行流程?

標簽:
PHP

电商网站框架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()方法。

public function createAction(){
    if ($this->_getSession()->isLoggedIn()) {
    $this->_redirect('*/*');
    return;
    }
    $this->loadLayout();
    $this->_initLayoutMessages('customer/session');
    $this->renderLayout();
}

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

<customer_account_create translate="label">
<label>Customer Account Registration Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>

<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block>
</reference>
</customer_account_create>

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一一对应完成显示逻辑。

點擊查看更多內(nèi)容
4人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質文章

正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優(yōu)惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消