mardi 21 février 2017

How do I use the SPA and Front Controller with in php?

For example, http://ift.tt/1fljiJ4

If you click another menu, url is in the form of a Front Controller, but Chrome's network tool will not redirecting the existing page.

example frontController.php

// require_once './index.php';

if ($_SERVER['REQUEST_URI'] == '/test1') {
  include 'test1.php';
} else if ($_SERVER['REQUEST_URI'] == '/tmp') {
  include 'tmp.php';
} else {
  include 'notfound.php';
}

always redirect index.php , I think it is natural.

How can I get it(SPA main file - index.*) to be called once?

Aucun commentaire:

Enregistrer un commentaire