简体   繁体   中英

Background php file processing without AJAX

Working with files compiler that puts a bit of a strain on FIRST homepage hit until the css files are compiled thus fooling the visitor that site is slow,

I have successfully routed the function to ajax witch works very well but I cant let it go since it is bound to js and would love to do this with php

the ajax mootools

new Request({
url: linktofile... and basic responses 

does nothing else but is accessing php file which says

// sitename.com/?view=custom
file_get_contents('OF_THE_website_but_different_view');

so how would I do this from php was trying exec() , cant get to work (WAMP local) CURL , would be same as if I would do file_get_contents() within homepage and slows everything down again was trying to see how proc_open() works but I cant figure it out

so if anyone could rout me to use any php function as a fallback for ajax and call my file_get_contents() file in backend without slowing the homepage down.

please do not suggest SHELL , CRON , or any other lang but PHP

Thank you!

Fund awesome reference

PHP Background Process Still Affecting Page Load

http://php.net/features.connection-handling#71172

header("Connection: close");
ob_start();
phpinfo();// or my page buffer previously saved in variable
$size=ob_get_length();
header("Content-Length: $size");
ob_end_flush();
flush();
file_get_contents('OF_THE_website_but_different_view');

works like charm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM