使用laravel

时间:2017-12-14 10:48:02

标签: php mysql ajax laravel-5

我有两个国家和城市的下拉列表。 城市下拉数据根据城市下拉使用ajax调用而变化。 除了两个国家在尝试加载城市时,每件事情都运行正常我收到服务器错误500而没有任何消息。 这是我在ajax调用中使用的控制器函数。 国家代码收到正确,但它给出了500个服务器错误,两个国家/地区代码为“FR”,德国代码为“DE” 我正在使用laravel 5.4

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\LkpCity;

class CommonController extends Controller {

    public function getCities() {
        $country_code = request('country_code');
        $cities = LkpCity::where('CountryCode', '=',$country_code)->get();
        return response()->json(['cities' => $cities]);
    }

}

我已经尝试使用laravel方法调试quire toSql()但是一切看起来都很正常。问题不能在本地机器上生成,只能在服务器上生成。 所以这里有什么帮助?为什么只有这两个国家/地区代码会出错?

1 个答案:

答案 0 :(得分:0)

因为您说错误仅在服务器上。 你确定这两个国家有DB记录吗?

如果是这样的话。尝试在您的服务器上转储查询并将其添加到您的问题中。与本地计算机上的查询相同