问题描述
我在 Linux 上的共享托管中发布了 Laravel 8 中的应用程序,本地运行完美,但在生产中抛出错误 419。许多帖子都说“@CRSF”丢失,但不是这种情况。此外,该应用程序在 Firefox 中运行良好,但不适用于 Chrome 或 Edge。我无法在像 PHP artisan cache:clear
或类似的服务器上运行任何命令,因为我已经上传了像 CPanel 这样的源代码。
<form role="form" id="clienteData" action="{{ route('clientes.update',$cliente->id) }}" method="POST">
@csrf
@method('PUT')
<div class="col-12">
<div class="form-group">
<strong>Nombre (*):</strong>
<input type="text" name="nombre" value="{{ $cliente->nombre }}" id="idNombreProveedor" class="form-control" placeholder="Nombre"/>
</div>
</div>
<div class="col-12">
<div class="form-group">
<strong>Siglas:</strong>
<input type="text" value="{{ $cliente->siglas }}" name="siglas" class="form-control" placeholder="Siglas"/>
</div>
</div>
<div class="col-12">
<div class="form-group">
<strong>REEUP:</strong>
<input type="text" value="{{ $cliente->reeup }}" name="reeup" class="form-control" placeholder="REEUP"/>
</div>
</div>
<div class="col-12">
<div class="form-group">
<strong>NIT *:</strong>
<input type="text" value="{{ $cliente->nit }}" name="nit" class="form-control" placeholder="NIT"/>
</div>
</div>
<div class="col-12">
<div class="form-group">
<strong>Teléfono:</strong>
<input type="text" value="{{ $cliente->telefono }}" name="telefono" class="form-control" placeholder="Teléfono"/>
</div>
</div>
<div class="col-12">
<div class="form-group">
<strong>Dirección:</strong>
<textarea class="form-control" style="height:150px" name="direccion" placeholder="Dirección">{{ $cliente->direccion }}</textarea>
</div>
</div>
<div class="col-12 text-center">
<button type="submit" class="btn btn-success btn-block">Actualizar</button>
</div>
</form>
.env 文件
APP_NAME=proyectname
APP_ENV=local
APP_KEY=base64:sECc6UgBwPVVeAfI4FVRje4KZpnHhALdWbgmtTNQRaw=
APP_DEBUG=false
APP_URL=http://domain.dom
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=MysqL
DB_HOST=192.168.12.48
DB_PORT=3306
DB_DATABASE=database
DB_USERNAME=user
DB_PASSWORD=password
broADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
REdis_HOST=127.0.0.1
REdis_PASSWORD=null
REdis_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Controller(我注释了__construct以避免登录)
class ClienteController extends Controller
{
/**
* display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
/*function __construct()
{
$this->middleware('permission:gestion_cliente',['only' => ['index','store','show','edit','update']]);
}*/
/**
* display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$title = "Datos del cliente";
$clientes = Cliente::all();
return view('clientes.index',compact('clientes','title'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$cliente = Cliente::create($request->all());
return redirect()->route('clientes.edit',$cliente)->with('success','Cliente insertado');;
}
/**
* display the specified resource.
*
* @param \App\Models\Cliente $cliente
* @return \Illuminate\Http\Response
*/
public function show(Cliente $cliente)
{
$title = "Datos del cliente";
return view('clientes.show',compact('cliente','title'));
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Cliente $cliente
* @return \Illuminate\Http\Response
*/
public function edit(Cliente $cliente)
{
$title = "Editando datos del cliente";
return view('clientes.edit','title'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Cliente $cliente
* @return \Illuminate\Http\Response
*/
public function update(Request $request,Cliente $cliente)
{
$cliente->update($request->all());
return redirect()->route('clientes.index')->with('success','Cliente modificado.');
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Cliente $cliente
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request)
{
$cliente = Cliente::find($request->id);
$cliente->delete();
return redirect()->route('clientes.index',$cliente)
->with('success','Cliente eliminado.');
}
}
<?PHP
use Illuminate\Support\Str;
return [
'driver' => env('SESSION_DRIVER','file'),'lifetime' => env('SESSION_LIFETIME',120),'expire_on_close' => false,'encrypt' => false,'files' => storage_path('framework/sessions'),'connection' => env('SESSION_CONNECTION',null),'table' => 'sessions','store' => env('SESSION_STORE','lottery' => [2,100],'cookie' => env(
'SESSION_COOKIE',Str::slug(env('APP_NAME','laravel'),'_').'_session'
),'path' => '/','domain' => env('SESSION_DOMAIN','secure' => env('SESSION_SECURE_COOKIE'),'http_only' => true,'same_site' => 'lax',];
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)