當前位置: 首頁>>代碼示例>>PHP>>正文


PHP City::findAll方法代碼示例

本文整理匯總了PHP中app\models\City::findAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP City::findAll方法的具體用法?PHP City::findAll怎麽用?PHP City::findAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\City的用法示例。


在下文中一共展示了City::findAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

                            .done(function( data ) {
                                $( "#' . Html::getInputId($model, 'emp_padd_state') . '" ).html( data );
                            }
                        );']);
?>
    <?php 
echo $form->field($model, 'emp_padd_state')->dropDownList(ArrayHelper::map(\app\models\State::find()->all(), 'state_id', 'state_name'), ['prompt' => '---Select State---', 'onchange' => '
                        $.get( "' . Url::toRoute('dependent/emp_p_city') . '", { id: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($model, 'emp_padd_city') . '" ).html( data );
                            }
                        );']);
?>

    <?php 
echo $form->field($model, 'emp_padd_city')->dropDownList(ArrayHelper::map(\app\models\City::findAll(['city_state_id' => $model->emp_padd_state]), 'city_id', 'city_name'), ['prompt' => '---Select City---']);
?>

    <?php 
echo $form->field($model, 'emp_padd_pincode')->textInput();
?>

    <?php 
echo $form->field($model, 'emp_padd_house_no')->textInput(['maxlength' => 25]);
?>

    <?php 
echo $form->field($model, 'emp_padd_phone_no')->textInput(['maxlength' => 25]);
?>

    <div class="form-group col-sm-offset-1 col-lg-10">
開發者ID:EduSec,項目名稱:EduSec,代碼行數:31,代碼來源:_form.php

示例2:

		</div>
		<div class = "col-sm-6 col-xs-12">
		    <?php 
echo $form->field($address, 'emp_padd_state')->dropDownList(ArrayHelper::map(\app\models\State::find()->where(['is_status' => 0])->all(), 'state_id', 'state_name'), ['prompt' => Yii::t('stu', '--- Select State ---'), 'onchange' => '
		                $.get( "' . Url::toRoute('dependent/emp_p_city') . '", { id: $(this).val() } )
		                    .done(function( data ) {
		                        $( "#' . Html::getInputId($address, 'emp_padd_city') . '" ).html( data );
		                    }
		                );']);
?>
		</div>
	</div>
	<div class="col-xs-12 col-lg-12 col-sm-12">
		<div class = "col-sm-6 col-xs-12">
		    <?php 
echo $form->field($address, 'emp_padd_city')->dropDownList(ArrayHelper::map(\app\models\City::findAll(['city_state_id' => $address->emp_padd_state, 'is_status' => 0]), 'city_id', 'city_name'), ['prompt' => Yii::t('stu', '--- Select City ---')]);
?>
		</div>
		<div class = "col-sm-6 col-xs-12">
		    <?php 
echo $form->field($address, 'emp_padd_pincode')->textInput(['maxlength' => 6]);
?>
		</div>
	</div>
	<div class="col-xs-12 col-lg-12 col-sm-12">
		<div class = "col-sm-6 col-xs-12">
		    <?php 
echo $form->field($address, 'emp_padd_house_no')->textInput(['maxlength' => 25]);
?>
		</div>
		<div class = "col-sm-6 col-xs-12">
開發者ID:EduSec,項目名稱:EduSec,代碼行數:31,代碼來源:emp_address.php

示例3:

		                    .done(function( data ) {
		                        $( "#' . Html::getInputId($model, 'report_section_id') . '" ).html( data );
		                    }
                        );']);
?>
	</div>
	<div class="col-xs-12 col-sm-4 col-lg-4">
	    <?php 
echo $form->field($model, 'report_section_id')->dropDownList(['' => Yii::t('stu', '--- Select Section ---')]);
?>
	</div>
      </div>
      <div class="row">
	<div class="col-xs-12 col-sm-4 col-lg-4">	
		 <?php 
echo $form->field($model, 'report_city')->dropDownList(ArrayHelper::map(\app\models\City::findAll(['is_status' => 0]), 'city_id', 'city_name'), ['prompt' => Yii::t('stu', '--- Select City ---')]);
?>
	</div>
	<div class="col-xs-12 col-sm-4 col-lg-4">
		 <?php 
echo $form->field($info, 'stu_gender')->dropDownList(stuInfo::getGenderOptions(), ['prompt' => Yii::t('stu', '--- Select Gender ---')]);
?>
	</div>
      </div>
      <hr>
      <div class="row">
		<?php 
echo $this->render('stu_select_form', ['query' => $query]);
?>
      </div>
   </div> <!--/ box-body -->
開發者ID:anazhd,項目名稱:EduSec,代碼行數:31,代碼來源:stu_report_view.php

示例4: actionGetYHWeather

 public function actionGetYHWeather($code = 'RSXX0063')
 {
     $cities = City::findAll(['country_id' => 162]);
     foreach ($cities as $city) {
         if ($city->yhcode) {
             $code = $city->yhcode;
             echo $city->name;
         } else {
             continue;
         }
         $units = 'c';
         $lang = 'en';
         $this->units = $units == 'c' ? 'c' : 'f';
         $url = 'http://xml.weather.yahoo.com/forecastrss?p=' . $code . '&u=' . $this->units;
         $xml_contents = file_get_contents($url);
         if ($xml_contents === false) {
             throw new Exception('Error loading ' . $url);
         }
         $xml = new \SimpleXMLElement($xml_contents);
         // Ветер
         $tmp = $xml->xpath('/rss/channel/yweather:wind');
         if ($tmp === false) {
             throw new Exception("Error parsing XML.");
         }
         $tmp = $tmp[0];
         $this->wind_chill = (int) $tmp['chill'];
         $this->wind_direction = (int) $tmp['direction'];
         $this->wind_speed = (int) $tmp['speed'];
         // Атмосферные показатели
         $tmp = $xml->xpath('/rss/channel/yweather:atmosphere');
         if ($tmp === false) {
             throw new Exception("Error parsing XML.");
         }
         $tmp = $tmp[0];
         $this->humidity = (int) $tmp['humidity'];
         $this->visibility = (int) $tmp['visibility'];
         $this->pressure = (int) $tmp['pressure'];
         // Время восхода и заката переводим в формат unix time
         $tmp = $xml->xpath('/rss/channel/yweather:astronomy');
         if ($tmp === false) {
             throw new Exception("Error parsing XML.");
         }
         $tmp = $tmp[0];
         $this->sunrise = strtotime($tmp['sunrise']);
         $this->sunset = strtotime($tmp['sunset']);
         // Текущая температура воздуха и погода
         $tmp = $xml->xpath('/rss/channel/item/yweather:condition');
         if ($tmp === false) {
             throw new Exception("Error parsing XML.");
         }
         $tmp = $tmp[0];
         $this->temp = (int) $tmp['temp'];
         $this->condition_text = strtolower((string) $tmp['text']);
         $this->condition_code = (int) $tmp['code'];
         // Прогноз погоды на 5 дней
         $forecast = array();
         $tmp = $xml->xpath('/rss/channel/item/yweather:forecast');
         if ($tmp === false) {
             throw new Exception("Error parsing XML.");
         }
         foreach ($tmp as $day) {
             $this->forecast[] = array('date' => strtotime((string) $day['date']), 'low' => (int) $day['low'], 'high' => (int) $day['high'], 'text' => (string) $day['text'], 'code' => (int) $day['code']);
         }
         $this->putDatasInTableNew();
     }
 }
開發者ID:roman1970,項目名稱:lis,代碼行數:66,代碼來源:WeatherController.php


注:本文中的app\models\City::findAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。