php - CI routing issue -


I am currently learning CI and I have come to an issue which I can not solve.

I am setting up my own VIMP server in Drive and inside the www (root) folder I have removed the codeigniter files! [Example] [1] [1]:

Then I created my PHP files for visual / model and controller and set the default route in config / routes.php

Now when If I go to my browser and type the local host, then post me. Php is displayed in no way.

But I am unable to access any view from here. For example, I have a new_post.php view and when I type in the address bar localhost / new_post.fpp, I did not "found"

The requested URL /new_post.php was not found on this server. " Error.

Am I doing wrong? Below I posted the code that I posted in the .php controller with an image named file structure / name.

posts.php - Administrator

  & lt ;? Expand Php class mail CI_Controller {function __ composition () {origin: __ creation (); $ This- & gt; Load-> Model ('post'); // loads the built-in model model in the modules} function index () // goes to this function when u controller {$ data ['post'] = $ this- & gt; Post- & gt; Get_posts (); // Load all the data of the get_posts function in the data model for data array Posted by $ this- & gt; Load-> View ('post_index', $ data); // load load} function post ($ post id) {$ data ['post'] = $ this- & gt; Post- & gt; Get_post ($ postID); $ This- & gt; Load-> View ('Post', $ data); } Function new_post () {if ($ _ POST) {$ data = array ('title' = & gt; $ _POST ['title'], 'post' = & gt; $ _POST ['post'], 'active '= & Gt; 1); $ This- & gt; Post & gt; Insert_post ($ data); Redirect (base_url). 'Post /'); } And {$ this- & gt; Load-> View ('new_post'); }} Function editpost ($ postID) {$ data ['success'] = 0; If ($ _ POST) {$ data_post = array ('title' = & gt; $ _POST ['title'], 'post' = & gt; $ _POST ['post'], 'active' => 1 ); $ This- & gt; Post & gt; Update_post ($ postid, $ data); $ Data ['success'] = 1; } $ Data ['post'] = $ this- & gt; Post- & gt; Get_post ($ postID); $ This- & gt; Load-> View ('edit_post', $ data); } Function deletepost ($ postID) {$ this- & gt; Post- & gt; Delete_post ($ postID); Redirect (base_url). 'Post /'); }}  

! [Structure] [1] [1]:

In the codeigner you get access to your function You have to use the controller

You are saying "when I type in localhost / new_post.fpp I did not get it" because you try to direct more information like this For example use your function name, for example, you can call it example.com / Controlername / functionname

  http: // localhost / posts / new_post  

check the Codeignier url

If you have not removed index.php using .htaccess, then you must use your URL like this

  http: // localhost / index.fpp / Post / New_Post  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -