How to enable generated CodeIgniter pages?

What would be the easiest way to include a CI file? Say I want to enable http://example.com/ci/index.php/mycontroller/ on example.com

example.com does not start CI, and I cannot enable include ('ci / index.php / mycontroller').

+4
source share
4 answers

As I could not call the CI controller functions, I decided that the easiest way to load the page was with jQuery:

$('#myDiv').load('ci/index.php/mycontroller', {}, function(){ $('#myDiv #loading').hide(); $('#myDiv #data').slideDown(500); }); 
+3
source

Assuming PHP is configured to allow a url , just ...

 include('http://example.com/ci/index.php/mycontroller/'); 

(Requires PHP 4.3.0 +)

+1
source

Depending on what you want to do, you should set REQUEST_URI or any other CI to define the request, and then just include the bootstrap file ...

EDIT . In fact, I think it would be better to go the other way around if that is possible (again, it depends on what exactly you want to do, so please let us know). I mean creating a CodeIgniter controller that just includes your script ...

0
source

If you just want to display the output of the CI script, you can open the URL, read the contents and output them - or use readfile() . From the point of view of the CI application, the request will come from the server turned on (and not the end user), and for the transfer of cookies / vars sessions, you will need to use something like cURL.

If you really want to include the source code , this is possible, but a security risk. There are several questions in this thread:

They note (among other things) that to enable the source you need to make sure that the CI site is not executing the page, but simply displaying the contents of the php file and that in fact, including the code from the URL, it is surprisingly dangerous.

You essentially trust the included site (and all the servers that the request goes through) to provide (good) code that will enable the server, which will run without question.

0
source

All Articles