这是我的搜索类型,其代码如下:
<input type="text" required ="required"name="city_code" id="code" autocomplete="off" class="form-control">
Run Code Online (Sandbox Code Playgroud)
这是我试图做的jquery:
function city_value()
{
return '/ajax/get_address_list?city_code='+$('#code').val();
}
$tmp_location={};
$('#code').autocomplete({
serviceUrl:city_value,
minChars:2,
lookupLimit: 25,
focus_suggestion:true,
transformResult: function(response) {
$tmp_location=$.parseJSON(response);
return {
suggestions: $tmp_location
};
}
});
Run Code Online (Sandbox Code Playgroud)
这是我的搜索自动完成类型的控制器:
function get_address_list(){
$post_code= $this->input->get("city_code",true);
$location_list=$this->ajax_m->m_get_address_like($post_code);
echo json_encode($location_list);
}
Run Code Online (Sandbox Code Playgroud)
这是模型:
function m_get_address_like($city_code){
$sql = "SELECT `singapore_address`,`singapore_postal_code`
FROM `uhd_singapore_address`
WHERE `singapore_postal_code`='$city_code%' OR (singapore_address LIKE '$city_code%')";
$query=$this->db->query($sql);
return $query->result_array();
}
Run Code Online (Sandbox Code Playgroud)
我已经使用了firebug进行了检查,我的autocomplete.js中出现了以下错误
Autocomplete.formatResult = function (suggestion, currentValue) {
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value.replace(new RegExp(pattern, 'gi'), …Run Code Online (Sandbox Code Playgroud) 我在 Laravel 框架中很新,我来自 codeigniter。
我想从数据库中添加新的键和值
static function m_get_promotion_banner(){
$query = DB::table("promotion_banner")
->select('promotion_banner_id','promotion_link','about_promotion')
->where('promotion_active','1')
->get();
if($query != null){
foreach ($query as $key => $row){
$query[$key]['promotion_image'] = URL::to('home/image/banner/'.$row['promotion_banner_id']);
}
}
return $query;
}
Run Code Online (Sandbox Code Playgroud)
该代码刚刚从 codeigniter 更改为 laravel,因为在 codeigniter 中,在foreach语句中传递新的键和值没有问题
但是当我在 Laravel 中尝试时,出现以下错误:
间接修改重载元素的
Illuminate\Support\Collection无效at HandleExceptions->handleError(8, 'Illuminate\Support\Collection 的重载元素的间接修改无效', 'C:\xampp\htdocs\laravel-site\application\app\models\main\Main_home_m.php', 653,数组('查询' => 对象(集合),'行' => 数组('promotion_banner_id' => 1,'promotion_link' => ' http://localhost/deal/home/voucher ','about_promotion' => ''), 'key' => 0))
请指导我如何解决这个问题
谢谢你 (:
我试图League Glide用于显示我的图像,这是我的代码:
require(APPPATH.'vendor/autoload.php');
use League\Flysystem\Adapter\Local;
use League\Flysystem\Filesystem;
function league_image(){
$array = array(
'source' => new Filesystem(new Local(realpath(APPPATH.'../../images'))),
'cache' => new Filesystem(new Local(realpath(APPPATH.'../../images/cache/'))),
);
$server = League\Glide\ServerFactory::create(
$array;
);
$server->setSourcePathPrefix('source');
$server->setCachePathPrefix('cache');
return $server;
}
Run Code Online (Sandbox Code Playgroud)
我得到了 glide 文件夹,使用 zip 而不是将它移入 vendor
我遇到了以下错误:
致命错误:
Class 'League\Glide\ServerFactory' not found in C:\xampp\htdocs\deal\application\helpers\image_helper.php on line 106A PHP Error was encountered严重性:
Error信息:
Class 'League\Glide\ServerFactory' not found文档名称:
helpers/image_helper.php电话号码:
106回溯:
伙计们,你能指导我这个错误是如何显示的吗?在phpstrom课堂上定义了如果Ctrl+click和我要去的部分ServerFactory
正如laravel-passport中提到的,登录控制器是由我们的路由器制成的php artisan make:auth,并且在我们的路由器中web.php会有Auth::routes();
我们的简单代码client-site
Route::get('/redirect', function () {
$query = http_build_query([
'client_id' => 'client-id',
'redirect_uri' => 'http://client-site/callback-responses-url',
'response_type' => 'code',
'scope' => ''
]);
return redirect('http://server-site/oauth/authorize?'.$query);
});
Run Code Online (Sandbox Code Playgroud)
如果用户未登录,http://server-site/oauth/authorize?'.$query将被重定向到http://server-site/login
无论如何,我想将登录控制器重定向到我的自定义登录控制器。然后,在我完成检查后,如果为真,将显示有关的视图authorization request agreement
只是我尝试检查oauth/authorize,但没有找到任何函数或控制器处理该链接。如果再给一次机会的话。我想知道更多关于laravel-passportoauth 如何工作的信息,所以我custom authorization view也可以在用户登录后进行操作
任何帮助都会非常有帮助谢谢(:
我有两个多维数组:
首先是类似的东西 (['one','one','three'],['four','five',five'],['one','one','one'])
而第二个是这样的 (['one','one','nine'],['one','one','one'],['two','two'],['two','two','two']...)
现在,我想要的是找到第一个数组与第二个数组的匹配第一个索引,但两个数组中至少前两个索引的位置也必须匹配,例如:
first_array(['one','one','three'],['four','five',five'],['one','one','one'])
会匹配
second_array(['one','one','nine'],['one','one','one'],['two','two'] ['two','two','two "] ...)
输出将是例如.'警报(' 匹配".).
我试过了
for(i=0; i<1; i++){
if(first_array[0] == second_array) console.log('Match');
else console.log('No match');
}
Run Code Online (Sandbox Code Playgroud)
但我总是得到'不匹配',尽管有一场比赛.PS在'for'循环中,我的i是i <1,因为我只想比较first_array的第一个索引和完整的second_array.
提前致谢
codeigniter ×2
laravel ×2
autocomplete ×1
composer-php ×1
database ×1
for-loop ×1
javascript ×1
jquery ×1
laravel-5 ×1
laravel-5.4 ×1
match ×1
oauth ×1
php ×1