I have a PHP script that works by calling items from a database based upon the time they were placed in there and it de开发者_JS百科letes them if they are older than 5 minutes. Basically, I want to now simulate what would happen if this database was being updated regularly.
So I was considering sticking in some code that loads an XML file then goes through and parses that into the database based upon the time data located within a node of the xml data... but the problem there is I want it to continually loop through an enter this data so it'll never actually run the other processes
So I was thinking of having another PHP script do that that could do this independantly of the php script that is going to display this data...
In theory:
I am looking to have a button that I can press and it will then run some php code to load up an XML file from a directory on my web server and then iterate though the data sending the data, to a database, based upon the time within a node in the PHP script and when the script was first called
So back to my page that displayed the data... if I continually hit refresh it will contain different results each time because data is being added by the other process and this php script removes the older data when it is refreshed
Any information on this?
Is there a way I can silently, and safely, run a php script without it being loaded into a browser... like a thread!?
Why not just run the PHP script that parses and inserts data into your DB from PHP's CLI?
http://www.php.net/manual/en/features.commandline.usage.php
精彩评论