PHP code example of ichynul / tpextareacity
1. Go to this page and download the library: Download ichynul/tpextareacity library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ichynul / tpextareacity example snippets
$form->fields('省/市/区');
$form->select('province', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('/api/areacity/province'), 'ext_name')->withNext(
$form->select('city', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('/api/areacity/city'), 'ext_name')->withNext(
$form->select('area', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('/api/areacity/area'), 'ext_name')
)
);
$form->fieldsEnd();
//或者
$form->fields('省/市/区')->with(
$form->select('province', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('/api/areacity/province'), 'ext_name')->withNext(
$form->select('city', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('/api/areacity/city'), 'ext_name')->withNext(
$form->select('area', ' ', 4)->size(0, 12)->showLabel(false)->dataUrl(url('/api/areacity/area'), 'ext_name')
)
);
);
return [
// 全局中间件
'' => [
],
'api' => [
\app\middleware\Cors::class,//跨域中间件(根据实际情况设置)
],
'areacity' => [
\app\middleware\Cors::class,//为areacity也设置一个跨域中间件
],
];