在我从事的项目中,有一个具有一些JS功能的PHP文件:
ParameterMap
该文件包含在使用这些功能的视图的末尾,如下所示:
public function store(Request $request)
{
$question = new Question;
$question->question = $request->question;
$question->question_type_id = $request->question_type;
$question->user_id = $request->Auth::id();
$question->save();
}
Quando olho nocódigofonte com o crtl + u asfunçõesestãotodaslá,mas quando tento executar qualquer uma,recebo esse erro:
未捕获的ReferenceError:未定义NOME_DA_FUNCAO [...]
最奇怪的是,如果我复制该函数并将其粘贴到包含它的相同位置,则在视图内部(在标签之间),我可以正常执行它。
答案 0 :(得分:-1)
将您的包含声明放入您的 head 部分
<html>
<head>
<?php include 'Includes/funcoes_ameai.php';?>
<title>do not forget to give a title</title>
</head>
<body>
</body>
</html>
答案 1 :(得分:-1)
尝试将脚本放入html的头部。
除使用方括号外:
include('Includes/funcoes_ameai.php');