PHP 7.0.26 Released

Voting

Please answer this simple SPAM challenge: min(four, one)?
(Example: nine)

The Note You're Voting On

CD001
7 years ago
It's a good idea to "hide" PHP anyway so you can write a RESTful web application.

Using Apache Mod Rewrite:

RewriteEngine On
RewriteRule ^control/([^/]+)/(.*)$ sitecontroller.php?control=$1&query=$2

You then use a function like the following as a way to retrieve data (in a zero indexed fashion) from the $_GET superglobal.

<?php
function myGET() {
 
$aGet = array();

  if(isset(
$_GET['query'])) {
   
$aGet = explode('/', $_GET['query']);
  }

  return
$aGet;
}
?>

This is only a really basic example of course - you can do a lot with Mod Rewrite and a custom 'GET' function.

<< Back to user notes page

To Top