我在文件夹/var/www/html/myproject
中有我的laravel项目,当我在浏览器示例中键入路由时:127.0.0.2/api/v1/cuentas
(因为我使用公共IP)我无法看到我的视图,它通过我
Not Found
The requested URL /api/v1/cuentas was not found on this server.
Apache/2.2.15 (CentOS) Server at (ip) Port 80
cuentas
文件是php 我的路线:
Route::group(array('prefix' => 'api/v1'), function()
{
Route::resource('cuentas','cuentaPruebaController');
});
我的控制器:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\cuentum;
class cuentaPruebaController extends Controller
{
public function index() {
try {
$response = [
'cuentas' => []
];
$statusCode = 200;
$cuenta = \App\cuentum::all();
foreach ($cuenta as $item) {
$response['cuentas'][] = [
'id_cuenta' => $item->id_cuenta,
'nombre' => $item->nombre,
'apellido' => $item->apellido,
'ci' => $item->ci,
'domicilio' => $item->domicilio,
'telefono' => $item->telefono,
'dispositivo_id' => $item->dispositivo_id,
'estado' => $item->estado,
];
}
} catch (Exception $e) {
$statusCode = 404;
} finally {
return \Response::json(array($response, $statusCode));
}
}
}
并返回一个json文件。
该路线可用:
怎么了? 谢谢!