In front-end I show list of products and vendor name to the user with search option. In that product list having the forward{/} and back slash'\'. If user can using only with '/' or '\'. It is not working. It will escaping the double quotes{"} or single quotes{'} next to the back slash '\'. Using Ajax for fetch the data from database. How to handle this scenario?
Here I am using Laravel MySql for backend:
public function productSearch(Request $request)
{
$products= Products::whereLike(['product', 'vender.name'], $request->filterText)->get();
return $products;
}
Try to pass the text to this function:
$str = addslashes($str);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.