本文整理汇总了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">
示例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">
示例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 -->
示例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();
}
}