我有选择名称 slc_pc,我想通过 jquery 代码附加选项。
我试试这些脚本。但它不起作用。
$("select[name='slc_pc']").append(new Option("Hello", "Hello", true, true).attr("abc",brand,"123",model));
Run Code Online (Sandbox Code Playgroud) 我使用 Laravel 作为后端并通过 JSON 生成 API,我使用 php 获取 json 数据并通过 Laravel 中的路由 api 删除数据,但它似乎不起作用。我在 laravel 中的 API 路线
Route::delete('articles/{article}', 'ArticleController@delete');
Run Code Online (Sandbox Code Playgroud)
我的控制器
public function delete(Article $article)
{
$article->delete();
return response()->json(null);
}
Run Code Online (Sandbox Code Playgroud)
我的 API 网址
http://192.168.0.21/api/articles/id
Run Code Online (Sandbox Code Playgroud)
我的 PHP 前端删除代码
$json = file_get_contents('http://192.168.0.21/api/articles/' . $id);
$json_data = json_decode($json, true);
unset($json_data['id']);
Run Code Online (Sandbox Code Playgroud)
这些有什么解决办法吗?
我在MySQl中尝试以下代码:
SELECT
A.*,
B.name,
C.name
FROM
eventlog_tbl as A
LEFT JOIN users B ON A.byuser=B.email
LEFT JOIN users C ON A.affectiveuser=C.email;
Run Code Online (Sandbox Code Playgroud)
我在Laravel中尝试这些
return DB::table('eventlog_tbl')
->leftjoin('users', 'users.email', '=', 'eventlog_tbl.byuser')
->leftjoin('users', 'users.email', '=', 'eventlog_tbl.affectiveuser')
->select('eventlog_tbl.*','users.name','users.name')
->get();
Run Code Online (Sandbox Code Playgroud)
如何将其转换为Laravel?