diff options
author | xue <> | 2006-09-16 19:47:15 +0000 |
---|---|---|
committer | xue <> | 2006-09-16 19:47:15 +0000 |
commit | 8e3f638109ebdb4bedc3e9ed7360b9d2467bc311 (patch) | |
tree | 4569dd64b27d103a8807eb1545d63df69cd2c5bf /framework | |
parent | 183fdd0dfce8dbff9f3b917fab9a8f9b59dd5e0d (diff) |
Fixed #378
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Web/THttpRequest.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index dc3143e6..33839ed0 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -130,6 +130,16 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar */
public function init($config)
{
+ // Fill in default request info when the script is run in command line
+ if(php_sapi_name()==='cli')
+ {
+ $_SERVER['REMOTE_ADDR']='127.0.0.1';
+ $_SERVER['REQUEST_METHOD']='GET';
+ $_SERVER['SERVER_NAME']='localhost';
+ $_SERVER['SERVER_PORT']=80;
+ $_SERVER['HTTP_USER_AGENT']='';
+ }
+
// Info about server variables:
// PHP_SELF contains real URI (w/ path info, w/o query string)
// SCRIPT_NAME is the real URI for the requested script (w/o path info and query string)
|