本文整理汇总了PHP中State::findBycountryid方法的典型用法代码示例。如果您正苦于以下问题:PHP State::findBycountryid方法的具体用法?PHP State::findBycountryid怎么用?PHP State::findBycountryid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State
的用法示例。
在下文中一共展示了State::findBycountryid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_stateAction
/**
* @Route("/get_state/{countryid}", methods={"POST"}, name="get_statetest")
*/
public function get_stateAction($countryid)
{
$state = State::findBycountryid($countryid)->toArray();
$data = array();
foreach ($state as $stateitem) {
$data[] = array('id' => $stateitem['id'], 'state' => $stateitem['state']);
}
echo json_encode($data);
}
示例2: get_stateAction
/**
* @Route("/get_state/{countryid}", methods={"POST"}, name="get_state")
*/
public function get_stateAction($countryid)
{
$state = State::findBycountryid($countryid)->toArray();
echo '<select id="stateid" name ="stateid">';
echo '<option value ="0" >Seleccione un Estado</option>';
foreach ($state as $stateitem) {
echo '<option value ="' . $stateitem["id"] . '" >' . $stateitem["state"] . '</option>';
}
echo '</select>';
}
示例3: get_state_dataAction
/**
* @Route("/get_state_data/{countryid}", methods={"POST"}, name="get_state_data")
*/
public function get_state_dataAction($countryid)
{
$this->view->disable();
$statedata = State::findBycountryid($countryid)->toArray();
echo json_encode($statedata);
}