Jump to content

Recommended Posts

I am at the point where I am needing to access passed variable in my framework I am building.  On the blog tutorial the codeigniter, you access the variables thought the uri_helper class which you can do in my url_helper class however I was wondering if any other frameworks allow to set parameters for controller functions and the framework automatically sets the parameters if the function/method has any?  If so how would this be possible is PHP.  I was thing I could use the Reflection Class but I here that it is very slow and I don't want to add that type of bottleneck to the application(since a lot of my function would have parameters.  Doe anyone know how rails handles this?

Link to comment
https://forums.phpfreaks.com/topic/82047-accessing-variables-in-mvc-framework/
Share on other sites

  • 4 weeks later...

Anyone?

 

Do any other frameowrks allow you do pass the url variables in a mvc type url and parameters in controller function or no.  is this currently hte standard way of doing thing in a mvc framework:

 

//in controller class

 

public function login()

{

    $username = $this->url_helper->get_variable(1);

    $password  = $this->url_helper->get_variable(2);

 

    //code to perform login and whatever

}

 

or do others allow:

 

public function login($username, $password)

{

    //code to perform login and whatever

}

 

Just wondering if there is a way to automate and allow users to pass controller method parameters and automatically parse the url and pass them to the function.

I've typically gone with the second option you have there. However, I've been giving some thought to it more recently and think there might be some more value/flexibility in something similar to the first option. I'll try to formulate some more thoughts/specifics when I get a spare moment, but that's my initial thoughts at a glance.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.