我在我的项目中使用responsive File Manager。我需要在其公共文件夹内的配置文件中添加CSRF令牌。在该配置文件中使用csrf_token()
并不起作用:
$token = csrf_token(); //this is inside filemanager confing.php
Fatal error: Call to undefined function csrf_token() in
E:\xampp\htdoc\site\public\plugin\filemanager\config\config.php on line 7
那么如何在公共文件夹中访问此功能?或者完全从Laravel典型的pathes中访问app实例?
答案 0 :(得分:0)
也许尝试关闭该路由的csrf保护,或者将此代码添加到启用该编辑器的页面标题中:
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': "{{ csrf_token() }}"
}
});
});
</script>