note 114768 added to reserved.variables.argc

From: Date: Thu, 03 Apr 2014 16:57:55 +0000
Subject: note 114768 added to reserved.variables.argc
Groups: php.notes 
Request: Send a blank email to php-notes+get-199113@lists.php.net to get a copy of this message
To decide whether my script is run from CLI I simply create a PHP script that handles only CLI invocations. File cron.php: <?php // Set environment variables your application depends on $_SERVER[ 'HTTP_HOST' ] = 'domain.tld'; // $_SERVER[ 'REQUEST_URI' ] = '/some/URI/if/needed'; // Use the environment to read out required values $task = $_SERVER[ 'argv' ][ 1 ]; // Instanciate the dispatcher or whatever you use $dispatcher = new Dispatcher(); $dispatcher->handle( $task ); ?> This way my application doesn't have to know about CLI at all. ---- Server IP: 72.52.91.14 Probable Submitter: 46.140.81.74 ---- Manual Page -- http://php.net/manual/en/reserved.variables.argc.php Edit -- https://master.php.net/note/edit/114768 Del: integrated -- https://master.php.net/note/delete/114768/integrated Del: useless -- https://master.php.net/note/delete/114768/useless Del: bad code -- https://master.php.net/note/delete/114768/bad+code Del: spam -- https://master.php.net/note/delete/114768/spam Del: non-english -- https://master.php.net/note/delete/114768/non-english Del: in docs -- https://master.php.net/note/delete/114768/in+docs Del: other reasons-- https://master.php.net/note/delete/114768 Reject -- https://master.php.net/note/reject/114768 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199113) next »