Login   Register  
PHP Classes
elePHPant
Icontem

File: testargv.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dennis T Kaplan  >  CLI args  >  testargv.php  >  Download  
File: testargv.php
Role: Example script
Content type: text/plain
Description: Example usage
Class: CLI args
Parse and process command line arguments
Author: By
Last change: Accessible without user login
Date: 4 years ago
Size: 554 bytes
 

Contents

Class file image Download
#!/usr/bin/env php
<?php

/**
 * This file has been created to test the class argv();
 */
include_once 'argv.php';

$obj = new argv();
$obj->set_text('You must be in the MVC root folder when executing!');
$obj->set_arg('root');
$obj->set_required(true);
$obj->set_value('y');
$obj->set_text('Set config file name');
$obj->set_arg('cfg');
$obj->set_required(true);
$obj->set_value('config.php');

$result $obj->run($argv);
$cfg $result['cfg'];

echo 
"\n\n\tParsing your $cfg\n\n";
print_r($result);
echo 
"\n\n\tParsing END\n\n";