我开始了一个laravel + vuejs项目(同一项目中的fontend和backend)。 基本上,这是从纯php-html项目进行的迁移。我想知道是否有可能只迁移其中一部分,而将其余部分整合。 回答完之后(感谢:)),这是myview.blade.php:
@extends('template')
@section('contenu')
<div id="app">
@php
$path = public_path('myview/oldfile.php');
include($path);
@endphp
</div>
@endsection
现在我有一个问题:
**问题1 **
我在旧的php文件中有这种代码:
<script type="text/javascript" src="./js/jquery-1.7.2.min.js">
但是我的模板中也有脚本(包含导航栏和页脚)。那我当然会得到这个错误
[Vue warn]: Error compiling template:
Templates should only be responsible for mapping the state to the UI. Avoid placing tags with side-effects in your templates, such as <style>, as they will not be parsed.
**第2期**
$.post("./myview.php", "mode=activateForm&id1=<?=$id1?>&id2=<?=$_GET["id2"]?>", function() {
MethodNotAllowedHttpException
The POST method is not supported for this route. Supported methods: GET, HEAD.
新问题是这个,我不知道为什么...
有什么建议吗?
答案 0 :(得分:1)
将文件放在公用文件夹中,并在包含声明中使用public_path('filename.php');
。
答案 1 :(得分:1)
在刀片模板中使用@include时,它将在resource/views
目录内查找文件。
因此请像@include('posts/index')
一样使用它。
它将在views/posts/
目录中查找index.php。
请勿在@include内使用.php。
@extends('template')
@section('contenu')
<div id="app">
@include("yourDirectory/oldfile");
</div>
@endsection