I am from java/j2ee, new to PHP, some questions:
1. if I put all functions into functions.php, then how can I call one specified function when submitting a form ? In J2EE, if using Spring framework, we can use different controller to achieve this ?
2. how could I redirect a page ? in java Servlet, we can use redirect/forward , what about PHP ?
3. PHP has filter concept ? if yes ,how to implement it ?
Thanks.
PHP questions
Moderator: General Moderators
Re: PHP questions
If you're comparing vanilla PHP to Java + Spring then you're off to a bad start.czy11421 wrote:1. if I put all functions into functions.php, then how can I call one specified function when submitting a form ? In J2EE, if using Spring framework, we can use different controller to achieve this ?
Use include or require to "execute" a file. That'll define the functions and then you can use them.
Before you output anything,czy11421 wrote:2. how could I redirect a page ? in java Servlet, we can use redirect/forward , what about PHP ?
Code: Select all
header("Location: http://www.example.com/path/to/new/location");
exit;What kind of filters? You mean like this?czy11421 wrote:3. PHP has filter concept ? if yes ,how to implement it ?