run.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. define('InShopNC',true);
  3. $x = time();
  4. $member_birthday = strftime ("%Y-%m-%d %H:%M:%S",time());
  5. function is_date($time)
  6. {
  7. $pattern = '/[\d]{4}-[\d]{1,2}-[\d]{1,2}/';
  8. return (preg_match($pattern, $time) == 1);
  9. }
  10. $x = '';
  11. $y = isset($x);
  12. if('safdasefasefasf'==0){
  13. echo "该字符串转换为数字 等于 0 <br/>";
  14. }//output:该字符串转换为数字 等于零。
  15. $a='0';
  16. if($a==''){
  17. echo "0 等于 '' <br/>";
  18. } //output:0 等于''
  19. if(trim($a)==''){
  20. echo "trim(0)等于'' <br/>";
  21. } //no output
  22. if($a===''){
  23. echo "0==='' <br/>";
  24. } //no output
  25. if(empty($a)){
  26. echo "'' is empty <br/>";
  27. } //output:'' is empty
  28. if(is_null($a)){
  29. echo "0 is null <br/>";
  30. } //no output
  31. if(is_numeric($a)){
  32. echo "0 is numeric <br/>";
  33. } //output:0 is numeric
  34. if(is_string($a)){
  35. echo "0 is string <br/>";
  36. } //no output
  37. if(strval($a)==''){
  38. echo "转换成字符串的0 is '' <br/>";
  39. } //no output
  40. //========= 判断 0 和 '' 以及 empty null false的关系 end =========//
  41. //========= 判断 '' 和 0 以及 empty null false的关系 start =========//
  42. $b = '';
  43. if($b==0){
  44. echo "'' 等于 0 <br/>";
  45. } //output:'' 等于 0
  46. if(!''){
  47. echo "'' 就是false <br/>";
  48. } //output:'' 就是false
  49. if(!0){
  50. echo "0 就是false <br/>";
  51. } //output:0 就是false
  52. //========= 判断 '' 和 0 以及 empty null false的关系 end =========//
  53. echo "在判断空('')的时候一定要小心,0 也相当于'' ,0 和 '' 都相当于空字符和false,判断为空最好用===";
  54. $x = '1978-02-05';
  55. $y = is_date($x);
  56. $x = time();
  57. $member_birthday = strftime ("%Y-%m-%d","{$x}");
  58. $time = strtotime($member_birthday);
  59. $str = NULL;
  60. $y = '';
  61. if(isset($str)) {
  62. $x = 0;
  63. }
  64. if(empty($str)) {
  65. $x = 1;
  66. }
  67. if($str == NULL) {
  68. $x = 2;
  69. }
  70. if(isset($y)) {
  71. $x = 0;
  72. }
  73. if(empty($y)) {
  74. $x = 1;
  75. }
  76. if($y == NULL) {
  77. $x = 2;
  78. }
  79. $file = "/mobile/index.php";
  80. $ops = explode("?",$file);
  81. $squery = $ops[1];
  82. $params = preg_split('/&|=/', $squery);
  83. for ($i = 0; $i < count($params); ++$i) {
  84. $key = $params[$i];
  85. $val = $params[++$i];
  86. $_GET[$key] = $val;
  87. $_POST[$key] = $val;
  88. }
  89. $ret = array('jsObj' => NULL,'jsArray' => array());
  90. unset($ret['xxx']);
  91. $ret = json_encode($ret);
  92. define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
  93. echo BASE_ROOT_PATH."\n";
  94. require_once (BASE_ROOT_PATH . '/fooder.php');
  95. echo $argv;
  96. function help_out()
  97. {
  98. echo "fetch_goods:start fetch goods.\r\n";
  99. echo "fillgcid:start fill all goods class id.\r\n";
  100. echo "checkgoods:check all goods class id.\r\n";
  101. }
  102. $time = -microtime();
  103. //$hash = 0;
  104. //for ($i=0; $i < rand(1000,4000); ++$i) {
  105. // $hash ^= md5(substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, rand(1,10)));
  106. //}
  107. $time += microtime();
  108. $y = sprintf('%f', $time);
  109. $y = strtotime('2016-12-12 01:01:01');
  110. $y = urldecode('%E4%B8%AD%E9%80%9A%E5%BF%AB%E9%80%92');
  111. $x=new date();
  112. define('StartTime', microtime(true));
  113. define('TIMESTAMP', time());
  114. if(count($argv) == 1) {
  115. return;
  116. }
  117. $gfcgi_run = 1;
  118. if($gfcgi_run == 0) { //模拟请求
  119. $file = BASE_ROOT_PATH . '/debug_run.php';
  120. include $file;
  121. Base::mobile_init();
  122. Base::mobile_control();
  123. } elseif ($gfcgi_run == 1) {
  124. $file = BASE_ROOT_PATH . '/research/research_run.php';
  125. include $file;
  126. } else {
  127. Base::run_util();
  128. $file = BASE_CRONTAB_PATH . '/crawl/fetch_goods.php';
  129. require $file;
  130. }
  131. ?>