如何获得LARAVEL的价值/信息?
admin.blade.php:https://pastebin.com/XHMM3PN9
GeneralController.php
$socket = $_POST['compr'];
ROUTE:
Route::post('sname', 'GeneralController@Sname')->middleware(['auth','admin:6']);
答案 0 :(得分:0)
据我所知,您希望从控制器中的请求中获取输入值。
您可以按照以下方式执行此操作:
use Illuminate\Http\Request;
class GeneralController extends Controller
{
public function Sname(Request $request)
{
$compr = $request->input('compr');
// do something with your input
}
}
答案 1 :(得分:0)
您的表格应该是:
<form name="fname" action="{{ url('sname') }}" method="post">
<legend>Server Name</legend>
<textarea name="compr" rows="1" placeholder="Server Name" class="form-control">{{ old('compr') }}</textarea>
<input class="btn btn-success btn-sm btn-block" type="submit" value="Set Server Name" />
</form>
控制器方法:
public function Sname(Request $request) {
$socket = $request->compr;
}
祝你好运。