查询多行数据

@return array
9088
public function findAll()
    {
        $this->compile();
        $queryArr   = $this->queryArr;
        return $this->connection->fetchAll(implode(" ", $queryArr), $this->arguments);
    }
877128
public static function run()
    {
        try {

            self::init();

            // 设置系统时区
            date_default_timezone_set(self::$config['default_timezone']);

            // 是否开启debug
            self::$debug = self::$config['app_debug'];

            // 初始化路由
            Route::init();

        } catch (\Exception $e) {
            throw new \Exception($e->getMessage());
        }
        return self::$config;
    }
148656
public function get(): array
    {
        /**
         * @var $queryObject   \Pecee\Pixie\QueryBuilder\QueryObject
         * @var $executionTime float
         * @var $start         float
         * @var $result        array
         */

        $queryObject = $this->getQuery();
        $this->connection->setLastQuery($queryObject);

        $this->fireEvents(EventHandler::EVENT_BEFORE_SELECT, $queryObject);

        $executionTime = 0;
        $startTime = microtime(true);

        if ($this->pdoStatement === null) {

            [$this->pdoStatement, $executionTime] = $this->statement(
                $queryObject->getSql(),
                $queryObject->getBindings()
            );
        }

        $result = \call_user_func_array([$this->pdoStatement, 'fetchAll'], $this->fetchParameters);
        $this->pdoStatement = null;

        $executionTime += microtime(true) - $startTime;

        $this->fireEvents(EventHandler::EVENT_AFTER_SELECT, $queryObject, [
            'execution_time' => $executionTime,
        ]);

        return $result;
    }
651919
public function execute()
    {
        $returnValues = array();
        
        while ($execute = array_shift($this->executeParameters)) {
            $returnValues[] = $this->run($execute);
        }
        
        return $returnValues;
    }
849876
public function execute()
    {
        $stmt = $this->connection->prepare($this->getSQL());
        $stmt->execute($this->getParams());

        return $this->counting ? (int) $stmt->fetchColumn() : $stmt->fetchAll();
    }
231121
public function fetchAll(): array
    {
        $st = $this->run();
        try {
            return $st->fetchAll(\PDO::FETCH_ASSOC);
        } finally {
            $st->close();
        }
    }
16155
public function run()
    {
        $countries = [
            'AF' => 'Afghanistan',
            'AL' => 'Albania',
            'DZ' => 'Algeria',
            'AS' => 'American Samoa',
            'AD' => 'Andorra',
            'AO' => 'Angola',
            'AI' => 'Anguilla',
            'AQ' => 'Antarctica',
            'AG' => 'Antigua And Barbuda',
            'AR' => 'Argentina',
            'AM' => 'Armenia',
            'AW' => 'Aruba',
            'AU' => 'Australia',
            'AT' => 'Austria',
            'AZ' => 'Azerbaijan',
            'BS' => 'Bahamas',
            'BH' => 'Bahrain',
            'BD' => 'Bangladesh',
            'BB' => 'Barbados',
            'BY' => 'Belarus',
            'BE' => 'Belgium',
            'BZ' => 'Belize',
            'BJ' => 'Benin',
            'BM' => 'Bermuda',
            'BT' => 'Bhutan',
            'BO' => 'Bolivia',
            'BA' => 'Bosnia And Herzegovina',
            'BW' => 'Botswana',
            'BV' => 'Bouvet Island',
            'BR' => 'Brazil',
            'IO' => 'British Indian Ocean Territory',
            'BN' => 'Brunei Darussalam',
            'BG' => 'Bulgaria',
            'BF' => 'Burkina Faso',
            'BI' => 'Burundi',
            'KH' => 'Cambodia',
            'CM' => 'Cameroon',
            'CA' => 'Canada',
            'CV' => 'Cape Verde',
            'KY' => 'Cayman Islands',
            'CF' => 'Central African Republic',
            'TD' => 'Chad',
            'CL' => 'Chile',
            'CN' => 'China',
            'CX' => 'Christmas Island',
            'CC' => 'Cocos (keeling) Islands',
            'CO' => 'Colombia',
            'KM' => 'Comoros',
            'CG' => 'Congo',
            'CD' => 'Congo, The Democratic Republic Of The',
            'CK' => 'Cook Islands',
            'CR' => 'Costa Rica',
            'CI' => 'Cote D\'ivoire',
            'HR' => 'Croatia',
            'CU' => 'Cuba',
            'CY' => 'Cyprus',
            'CZ' => 'Czech Republic',
            'DK' => 'Denmark',
            'DJ' => 'Djibouti',
            'DM' => 'Dominica',
            'DO' => 'Dominican Republic',
            'TP' => 'East Timor',
            'EC' => 'Ecuador',
            'EG' => 'Egypt',
            'SV' => 'El Salvador',
            'GQ' => 'Equatorial Guinea',
            'ER' => 'Eritrea',
            'EE' => 'Estonia',
            'ET' => 'Ethiopia',
            'FK' => 'Falkland Islands (malvinas)',
            'FO' => 'Faroe Islands',
            'FJ' => 'Fiji',
            'FI' => 'Finland',
            'FR' => 'France',
            'GF' => 'French Guiana',
            'PF' => 'French Polynesia',
            'TF' => 'French Southern Territories',
            'GA' => 'Gabon',
            'GM' => 'Gambia',
            'GE' => 'Georgia',
            'DE' => 'Germany',
            'GH' => 'Ghana',
            'GI' => 'Gibraltar',
            'GR' => 'Greece',
            'GL' => 'Greenland',
            'GD' => 'Grenada',
            'GP' => 'Guadeloupe',
            'GU' => 'Guam',
            'GT' => 'Guatemala',
            'GN' => 'Guinea',
            'GW' => 'Guinea-bissau',
            'GY' => 'Guyana',
            'HT' => 'Haiti',
            'HM' => 'Heard Island And Mcdonald Islands',
            'VA' => 'Holy See (vatican City State)',
            'HN' => 'Honduras',
            'HK' => 'Hong Kong',
            'HU' => 'Hungary',
            'IS' => 'Iceland',
            'IN' => 'India',
            'ID' => 'Indonesia',
            'IR' => 'Iran, Islamic Republic Of',
            'IQ' => 'Iraq',
            'IE' => 'Ireland',
            'IL' => 'Israel',
            'IT' => 'Italy',
            'JM' => 'Jamaica',
            'JP' => 'Japan',
            'JO' => 'Jordan',
            'KZ' => 'Kazakstan',
            'KE' => 'Kenya',
            'KI' => 'Kiribati',
            'KP' => 'Korea, Democratic People\'s Republic Of',
            'KR' => 'Korea, Republic Of',
            'KV' => 'Kosovo',
            'KW' => 'Kuwait',
            'KG' => 'Kyrgyzstan',
            'LA' => 'Lao People\'s Democratic Republic',
            'LV' => 'Latvia',
            'LB' => 'Lebanon',
            'LS' => 'Lesotho',
            'LR' => 'Liberia',
            'LY' => 'Libyan Arab Jamahiriya',
            'LI' => 'Liechtenstein',
            'LT' => 'Lithuania',
            'LU' => 'Luxembourg',
            'MO' => 'Macau',
            'MK' => 'Macedonia, The Former Yugoslav Republic Of',
            'MG' => 'Madagascar',
            'MW' => 'Malawi',
            'MY' => 'Malaysia',
            'MV' => 'Maldives',
            'ML' => 'Mali',
            'MT' => 'Malta',
            'MH' => 'Marshall Islands',
            'MQ' => 'Martinique',
            'MR' => 'Mauritania',
            'MU' => 'Mauritius',
            'YT' => 'Mayotte',
            'MX' => 'Mexico',
            'FM' => 'Micronesia, Federated States Of',
            'MD' => 'Moldova, Republic Of',
            'MC' => 'Monaco',
            'MN' => 'Mongolia',
            'MS' => 'Montserrat',
            'ME' => 'Montenegro',
            'MA' => 'Morocco',
            'MZ' => 'Mozambique',
            'MM' => 'Myanmar',
            'NA' => 'Namibia',
            'NR' => 'Nauru',
            'NP' => 'Nepal',
            'NL' => 'Netherlands',
            'AN' => 'Netherlands Antilles',
            'NC' => 'New Caledonia',
            'NZ' => 'New Zealand',
            'NI' => 'Nicaragua',
            'NE' => 'Niger',
            'NG' => 'Nigeria',
            'NU' => 'Niue',
            'NF' => 'Norfolk Island',
            'MP' => 'Northern Mariana Islands',
            'NO' => 'Norway',
            'OM' => 'Oman',
            'PK' => 'Pakistan',
            'PW' => 'Palau',
            'PS' => 'Palestinian Territory, Occupied',
            'PA' => 'Panama',
            'PG' => 'Papua New Guinea',
            'PY' => 'Paraguay',
            'PE' => 'Peru',
            'PH' => 'Philippines',
            'PN' => 'Pitcairn',
            'PL' => 'Poland',
            'PT' => 'Portugal',
            'PR' => 'Puerto Rico',
            'QA' => 'Qatar',
            'RE' => 'Reunion',
            'RO' => 'Romania',
            'RU' => 'Russian Federation',
            'RW' => 'Rwanda',
            'SH' => 'Saint Helena',
            'KN' => 'Saint Kitts And Nevis',
            'LC' => 'Saint Lucia',
            'PM' => 'Saint Pierre And Miquelon',
            'VC' => 'Saint Vincent And The Grenadines',
            'WS' => 'Samoa',
            'SM' => 'San Marino',
            'ST' => 'Sao Tome And Principe',
            'SA' => 'Saudi Arabia',
            'SN' => 'Senegal',
            'RS' => 'Serbia',
            'SC' => 'Seychelles',
            'SL' => 'Sierra Leone',
            'SG' => 'Singapore',
            'SK' => 'Slovakia',
            'SI' => 'Slovenia',
            'SB' => 'Solomon Islands',
            'SO' => 'Somalia',
            'ZA' => 'South Africa',
            'GS' => 'South Georgia And The South Sandwich Islands',
            'ES' => 'Spain',
            'LK' => 'Sri Lanka',
            'SD' => 'Sudan',
            'SR' => 'Suriname',
            'SJ' => 'Svalbard And Jan Mayen',
            'SZ' => 'Swaziland',
            'SE' => 'Sweden',
            'CH' => 'Switzerland',
            'SY' => 'Syrian Arab Republic',
            'TW' => 'Taiwan, Province Of China',
            'TJ' => 'Tajikistan',
            'TZ' => 'Tanzania, United Republic Of',
            'TH' => 'Thailand',
            'TG' => 'Togo',
            'TK' => 'Tokelau',
            'TO' => 'Tonga',
            'TT' => 'Trinidad And Tobago',
            'TN' => 'Tunisia',
            'TR' => 'Turkey',
            'TM' => 'Turkmenistan',
            'TC' => 'Turks And Caicos Islands',
            'TV' => 'Tuvalu',
            'UG' => 'Uganda',
            'UA' => 'Ukraine',
            'AE' => 'United Arab Emirates',
            'GB' => 'United Kingdom',
            'US' => 'United States',
            'UM' => 'United States Minor Outlying Islands',
            'UY' => 'Uruguay',
            'UZ' => 'Uzbekistan',
            'VU' => 'Vanuatu',
            'VE' => 'Venezuela',
            'VN' => 'Viet Nam',
            'VG' => 'Virgin Islands, British',
            'VI' => 'Virgin Islands, U.s.',
            'WF' => 'Wallis And Futuna',
            'EH' => 'Western Sahara',
            'YE' => 'Yemen',
            'ZM' => 'Zambia',
            'ZW' => 'Zimbabwe',
        ];

        foreach ($countries as $code => $name) {
            \CleaniqueCoders\Profile\Models\Country::create([
                'code'  => $code,
                'name'  => $name,
                'label' => Str::slug($name, '-'),
            ]);
        }
    }
648419
public function run()
	{
		if(!empty($this->links)) {
		
			$links=array();
	
			foreach($this->links as $label=>$url) {
				if(is_string($label) || is_array($url))
					$links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url, array('title'=>$label));
				//else
				//	$links[] = '<span>'.($this->encodeLabel ? CHtml::encode($url) : $url).'</span>';
			}
		}
		
		/*
		if($this->homeLink===null)
			$links[]=CHtml::link(Yii::t('phrase', 'Close'), 'javascript:void(0);', array('title'=>Yii::t('phrase', 'Close'), 'class'=>'closed','off_address'=>''));
		elseif($this->homeLink!==false)
			$links[]=$this->homeLink;
		*/
		
		if(!empty($this->links)) {
			echo implode($this->separator,$links);
			echo ' '.Yii::t('phrase', 'or').' ';
		}
		echo CHtml::link(Yii::t('phrase', 'Close'), 'javascript:void(0);', array('title'=>Yii::t('phrase', 'Close'), 'class'=>'closed','off_address'=>''));
	}
1197090
public static function call()
	{
		$yurunControl = autoLoadControl(self::$control,self::$action);
		// 控制器是否存在
		if (false !== $yurunControl)
		{
			// 实例化控制器
			if (method_exists($yurunControl, self::$action))
			{
				$reflection = new ReflectionMethod($yurunControl, self::$action);
				self::prepareData($reflection->getParameters());
				unset($reflection);
				$returnResult = call_user_func_array(array(&$yurunControl,self::$action),self::$data);
			}
			else
			{
				$action = '_R_' . self::$action;
				if (method_exists($yurunControl, $action))
				{
					$reflection = new ReflectionMethod($yurunControl, $action);
					self::prepareData($reflection->getParameters());
					unset($reflection);
					$returnResult = call_user_func_array(array(&$yurunControl,$action),self::$data);
				}
				else
				{
					return false;
				}
			}
		}
		else
		{
			return false;
		}
		$param = array('returnResult'=>$returnResult);
		Event::trigger('YURUN_CONTROL_EXEC_COMPLETE',$param);
		return true;
	}
786166
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        if (preg_match('/\+A\w+-?/m', $this->value)) {
            if (function_exists('mb_convert_encoding')) {
                $this->value .= "\n".mb_convert_encoding($this->value, 'UTF-8', 'UTF-7');
            } else {
                //list of all critical UTF7 codepoints
                $schemes = [
                    '+ACI-'      => '"',
                    '+ADw-'      => '<',
                    '+AD4-'      => '>',
                    '+AFs-'      => '[',
                    '+AF0-'      => ']',
                    '+AHs-'      => '{',
                    '+AH0-'      => '}',
                    '+AFw-'      => '\\',
                    '+ADs-'      => ';',
                    '+ACM-'      => '#',
                    '+ACY-'      => '&',
                    '+ACU-'      => '%',
                    '+ACQ-'      => '$',
                    '+AD0-'      => '=',
                    '+AGA-'      => '`',
                    '+ALQ-'      => '"',
                    '+IBg-'      => '"',
                    '+IBk-'      => '"',
                    '+AHw-'      => '|',
                    '+ACo-'      => '*',
                    '+AF4-'      => '^',
                    '+ACIAPg-'   => '">',
                    '+ACIAPgA8-' => '">',
                ];

                $this->value = str_ireplace(
                    array_keys($schemes),
                    array_values($schemes),
                    $this->value
                );
            }
        }

        return $this->value;
    }
1197220
public function run()
    {
        $model = $this->model;

        if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && isset($_POST['ajax'])) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        }

        if ($model->load(Yii::$app->request->post())) {
            $textField = $this->textField;

            if ($model->save()) {

                if (!empty($this->gridviewCheckboxOptions)) {
                    $this->gridviewCheckbox();
                }

                if ($this->isSaveAndNew) {
                    Yii::$app->response->format = Response::FORMAT_JSON;
                    return [
                        'message' => 'saveAndNew',
                        'success' => true,
                        'saveAndNewUrl' => $this->saveAndNewUrl,
                        'id' => $model->id,
                        'text' => $model->$textField,
                    ];
                }

                if (isset($this->redirectToViewUrl)) {
                    return $this->controller->redirect([$this->redirectToViewUrl, 'id' => $model->id]);
                }

                Yii::$app->getSession()->setFlash('success', $this->successMsg);
                Yii::$app->response->format = Response::FORMAT_JSON;
                return [
                    'message' => 'success',
                    'success' => true,
                    'id' => $model->id,
                    'text' => $model->$textField,
                ];
            }

            Yii::$app->getSession()->setFlash('error', $this->errorMsg);
            Yii::$app->response->format = Response::FORMAT_JSON;
            return [
                'message' => 'error',
                'success' => false,
                'error' => print_r($model->getErrors()),
            ];
        }

        return $this->controller->renderAjax($this->view, array_merge([
            'model' => $model,
        ], $this->params));
    }
418130
public function run()
    {
        $searchModel = new LanguageSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
        $dataProvider->sort = ['defaultOrder' => ['status' => SORT_DESC]];

        return $this->controller->render('list', [
            'dataProvider' => $dataProvider,
            'searchModel' => $searchModel,
        ]);
    }
1003588
public function start()
    {
        $httpServer = $this->getHttpServer();

        // 是否正在运行
        if ($httpServer->isRunning()) {
            $serverStatus = $httpServer->getServerSetting();

            \output()->writeln("<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>", true, true);
        } else {
            $serverStatus = $httpServer->getServerSetting();
        }

        // 启动参数
        $this->setStartArgs($httpServer);
        $httpStatus = $httpServer->getHttpSetting();
        $tcpStatus = $httpServer->getTcpSetting();

        // Setting
        $workerNum = $httpServer->setting['worker_num'];

        // HTTP 启动参数
        $httpHost = $httpStatus['host'];
        $httpPort = $httpStatus['port'];
        $httpMode = $httpStatus['mode'];
        $httpType = $httpStatus['type'];

        // TCP 启动参数
        $tcpEnable = $serverStatus['tcpable'];
        $tcpHost = $tcpStatus['host'];
        $tcpPort = $tcpStatus['port'];
        $tcpType = $tcpStatus['type'];
        $tcpEnable = $tcpEnable ? '<info>Enabled</info>' : '<warning>Disabled</warning>';

        // 信息面板
        $lines = [
            '                         Server Information                      ',
            '********************************************************************',
            "* HTTP | host: <note>$httpHost</note>, port: <note>$httpPort</note>, type: <note>$httpType</note>, worker: <note>$workerNum</note>, mode: <note>$httpMode</note>",
            "* TCP  | host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, type: <note>$tcpType</note>, worker: <note>$workerNum</note> ($tcpEnable)",
            '********************************************************************',
        ];

        // 启动服务器
        \output()->writeln(implode("\n", $lines));
        $httpServer->start();
    }
847004
public function run()
    {
        $hostInfo = Yii::$app->getRequest()->getHostInfo();
        $controller = $this->controller;
        if (($serviceUrl = $this->serviceUrl) === null) {
            $serviceUrl = $hostInfo . Url::toRoute([$this->getUniqueId(), $this->serviceVar => 1]);
        }
        if (($wsdlUrl = $this->wsdlUrl) === null) {
            $wsdlUrl = $hostInfo . Url::toRoute([$this->getUniqueId()]);
        }
        if (($provider = $this->provider) === null) {
            $provider = $controller;
        }
        $this->_service = $this->createWebService($provider, $wsdlUrl, $serviceUrl);

        if (is_array($this->classMap)) {
            $this->_service->classMap = $this->classMap;
        }
        foreach ($this->serviceOptions as $name => $value) {
            $this->_service->$name = $value;
        }
        if (isset($_GET[$this->serviceVar])) {
            $this->_service->run();
        } else {
            return $this->_service->renderWsdl();
        }
    }
195618
public function run()
	{
		if( isset( $this->config['task_list'] ) && !empty( $this->config['task_list'] ) ){
			$task_list            = $this->config['task_list'];
			$cronLastExecTimeList = [];
			// 定时执行
			ServerManager::getInstance()->getServer()->tick( $this->config['loop_time'] * 1000, function() use ( &$task_list, &$cronLastExecTimeList ){
				// 分别执行
				foreach( $task_list as $name => $option ){
					try{
						// 是到期需执行 当前时间 > 最后一次时间 + 间隔时间
						$last_time     = isset( $cronLastExecTimeList[$name] ) ? $cronLastExecTimeList[$name] : 0;
						$current_time  = time();
						$interval_time = ceil( $option['interval_time'] );

						if( $current_time > ($last_time + $interval_time) ){
							// 设置最后一次执行时间 不可等任务执行完毕后再设置时间，因为会阻塞导致每秒进行一次
							$cronLastExecTimeList[$name] = $current_time;
							// 检测是否可执行
							if( \ezswoole\Cron::checkTask( $name, $option ) === true ){
								\EasySwoole\Core\Swoole\Task\TaskManager::async( function() use ( $name, $option ){
									\ezswoole\Cron::exec( $name, $option );
									return true;
								} );
							} else{
								// 删除该任务
								unset( $task_list[$name] );
							}
						}
					} catch( \Exception $e ){
						\EasySwoole\EasySwoole\Logger::getInstance()->log($e->getTraceAsString(),'error');
					}
				}
			} );
		}
		return true;
	}
769265
public function run()
    {
        if(Schema::hasTable(strtolower($this->model)))
        {
            $tableName = strtolower($this->model);
        }elseif(Schema::hasTable(strtolower($this->model)."s")) {
            $tableName = strtolower($this->model."s");
        }else{
            $tableName = "";
        }

        $tableColumns = $tableName != "" ? Schema::getColumnListing($tableName) : [];

        $module  = camel_case($this->module);
        $model   = camel_case($this->model);

        $paramColumns = array_diff($tableColumns, ["id", "created_at", "updated_at"]);

        $paramStrings = collect($paramColumns)->map(function($item){
            return "$".lcfirst(camel_case($item));
        })->toArray();

        $data = [
            "group"         => $this->group,
            "module"        => $module,
            "model"         => $model,
            "paramStrings"  => $paramStrings,
            "tableColumns"  => $paramColumns
        ];

        $this->makeDir();

        //列表视图
        $listsFilePath      = "views/".$this->group."/".$this->module."/".$this->model."_lists.blade.php";
        $listsTemplatePath  = $this->customTemplate ?: __DIR__."/template/view/lists.blade.php";

        $this->makeView($listsFilePath, $listsTemplatePath, $data);

        //创建视图
        $addFilePath        = "views/".$this->group."/".$this->module."/add_".$this->model.".blade.php";
        $addTemplatePath    = $this->customTemplate ?: __DIR__."/template/view/add.blade.php";

        $this->makeView($addFilePath, $addTemplatePath, $data);

        //编辑视图
        $editFilePath       = "views/".$this->group."/".$this->module."/edit_".$this->model.".blade.php";
        $editTemplatePath   = $this->customTemplate ?: __DIR__."/template/view/edit.blade.php";

        $this->makeView($editFilePath, $editTemplatePath, $data);

        //查看视图
        $viewFilePath       = "views/".$this->group."/".$this->module."/view_".$this->model.".blade.php";
        $viewTemplatePath   = $this->customTemplate ?: __DIR__."/template/view/view.blade.php";

        $this->makeView($viewFilePath, $viewTemplatePath, $data);
    }
582824
public function run()
    {
        return $this->render('user-list', [
            'dataProvider' => $this->dataProvider,
            'additionalColumns' => $this->additionalColumns,
            'actionColumn' => $this->actionColumn,
            'visible' => $this->visible,
            'tips' => $this->tips,
        ]);
    }