How can I retrieve the method in c in the v layer in phpmvc?

Source: Internet
Author: User
In phpmvc, how should I retrieve the method in c in the v layer? In phpmvc, how should I retrieve the method in c in the v layer? Both the data model m and the logic layer have been built by the project manager, but it is unclear how to call them. how can I call the output method? Please provide more guidance. I just joined the work and don't know about mvc. thank you ., This is similar to the TV. in php mvc, how should I retrieve the method in c on the v layer?
In php mvc, how should I retrieve the method in c in the v layer? Both the data model m and the logic layer have been built by the project manager, so it is unclear how to call them,
How can I call the output method? Please provide more guidance. I just joined the work and don't know about mvc. thank you.


------ Solution --------------------
This problem is similar.
How does the screen (V) of the TV (MVC) call the change (C) operation.
------ Solution --------------------
C-layer parsing template to replace V-layer variables

Or does the C layer directly include the V layer? Can I directly call the C layer?
------ Solution --------------------
We recommend that you take a look at the MVC basics first ~ This is unreasonable.
------ Solution --------------------
If you have time to look at the framework, such as thinkphp and zendframwork... There are also open-source products joomla, dedecms .....
------ Solution --------------------
It depends on what framework your company uses. different frameworks call different methods.
------ Solution --------------------
In vmode, variables and arrays are displayed, and the logic is rarely written in v. Generally, the logic is processed in the c or m layers, and the data is assigned to the View v in the c layer. It is unreasonable for you to do so.
------ Solution --------------------
You can call a public function !!
------ Solution --------------------
In PHP CodeIgniter, V is directly called in C, which is exactly the opposite of what you said. The Controller calls Model and View.
------ Solution --------------------
Some frameworks have fixed writing methods, as if Zend has the following:

HTML code
Url (array ("action" => "query", "controller" => "db");?> "> Try
------ Solution --------------------
Like smarty, c registers variable v with variable name for access

------ Solution --------------------
This approach is not recommended. I don't know how you implement this hierarchy,

I think the landlord can first find out the responsibilities of the three layers of MVC, and calling the functions or methods in C in V is not a good practice.
------ Solution --------------------
Passing
------ Solution --------------------
Passing jbknknk
------ Solution --------------------
Http://wenku.baidu.com/view/a5aede00bed5b9f3f90f1cb1.html
You can refer to this article to understand it by yourself.
------ Solution --------------------
If the MVC structure is used
In fact, the V layer is equivalent to the C layer.
Because the include v layer is basically used
The v layer can directly call the method in its c.
------ Solution --------------------
Have you learned ?? How do most people say that?
------ Solution --------------------
Ah ~~~~~~~~~~~~~~~~~~ ···
------ Solution --------------------
This is generally not allowed. if forced, you can pass the c object itself to v.

$ This-> view-> c = $ this.

Other registrars can be called as long as they are registered in the registrars.

Generally, layer v only displays variables. Do not call other. public functions are also a method!



------ Solution --------------------
Discussion

The architecture of my current website is phpcms is a bit unclear. thank you for your advice.

------ Solution --------------------
Let's take a look at the source code of the framework. different frameworks are different.
------ Solution --------------------
In mvc, M is the Model, that is, the composition of program functions and programs, such as databases, V is the View graphical interface, and C is the Controller that forwards and processes requests. In B/S mode, V is what the browser presents, and C is the php program of the server.

Back to the question "how to retrieve the method in c in the v layer", it is easy to use post, get, or ajax.
------ Solution --------------------
The above ajax is actually post, get

In fact, there are other methods. as long as the browser sends parameters to the server, the server performs corresponding actions based on the sent parameters.
------ Solution --------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.