cli_routing_sample.php 606 B

12345678910111213141516171819202122
  1. #!/usr/local/bin/php
  2. <?php
  3. /**
  4. * CLI routing example
  5. */
  6. error_reporting(E_ALL);
  7. include ('api/autoloader.php');
  8. $appName = ubRouting::optionCliMe();
  9. $usageNotice = 'Usage: ' . $appName . ' --option1=somedata --option2=anotherdata' . "\n";
  10. if (ubRouting::optionCliCount() >= 3) {
  11. if (ubRouting::optionCliCheck(array('option1', 'option2'))) {
  12. print('option1 value: ' . ubRouting::optionCli('option1', 'raw') . "\n");
  13. print('option2 value: ' . ubRouting::optionCli('option2', 'raw') . "\n");
  14. } else {
  15. print($usageNotice . '!!!!');
  16. }
  17. } else {
  18. print($usageNotice);
  19. }