TController.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. namespace fecadmin\controllers;
  10. use Yii;
  11. use yii\helpers\Url;
  12. use yii\web\Controller;
  13. /**
  14. * @author Terry Zhao <2358269014@qq.com>
  15. * @since 1.0
  16. */
  17. class TController extends Controller
  18. {
  19. public function ee(){
  20. echo 33;
  21. return 44;
  22. }
  23. public function dd($i){
  24. $i--;
  25. if($i > 0){
  26. ob_start();
  27. echo "test".$i;
  28. $str = ob_get_clean();
  29. return $str.$this->dd($i);
  30. }else{
  31. return 22;
  32. }
  33. }
  34. public function actionIndex(){
  35. echo $this->ee();
  36. ob_start();
  37. $dd = $this->ee();
  38. ob_get_clean();
  39. ob_end_flush();
  40. echo $dd;
  41. exit;
  42. ob_start();
  43. echo "Hellon/"; //输出
  44. echo $this->dd(6);
  45. ob_end_flush();//输出全部内容到浏览器
  46. exit;
  47. ob_start();
  48. // your includes
  49. echo ob_get_clean();
  50. exit;
  51. for($i = 1;$i<=32517;$i++){
  52. //$s = $this->getRandChar(15);
  53. //$str = "http://www.yiichina.com/search?q=".$s;
  54. //$str = "http://www.yiibai.com/yii2/".$s;
  55. $str = "http://www.yiichina.com/user/".$i;
  56. echo $str."<br>";
  57. }
  58. }
  59. public function getRandChar($length){
  60. $str = null;
  61. $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
  62. $max = strlen($strPol)-1;
  63. for($i=0;$i<$length;$i++){
  64. $str.=$strPol[rand(0,$max)];//rand($min,$max)生成介于min和max两个数之间的一个随机整数
  65. }
  66. return $str;
  67. }
  68. }