小编use*_*193的帖子

XML解析错误:XML或文本声明不在实体的开头

我的rss.php中有这个错误

XML解析错误:XML或文本声明不在实体的开头位置:http://blah.com/blah/blah/site/rss.php 第1行,第3列:
这显示在错误下面

<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><item><title>xzfbcbcxv 123</title><description><p>Description for the rss feed</p></description></item></channel></rss>
Run Code Online (Sandbox Code Playgroud)

---------------- ^

显示在页面左侧和?xml行之间.

在我的rss.php中我有

<?php header("Content-type: text/xml"); ?>
<?php include("includes/database.php");?>
<?php global $_TWITTER_TABLE, $_HTTP_ADDRESS, $_NEWS_TABLE; ?>
<?php $str = '<?xml version="1.0" encoding="UTF-8"?>'; ?>
<?php $str .= '<rss version="2.0">';?>
<?php
$str.='<channel>';
$sql = "SELECT * FROM $_NEWS_TABLE LIMIT 5";
$result = mysql_query($sql) or die ($sql."".mysql_error());
    while($row = mysql_fetch_object($result)){
        $str.= '<item>';
                $str.= '<title>'.$row->title. '</title>';
                $str.= '<description>'.$row->content. '</description>';
        $str.= '</item>';
}
$str.= '</channel>';
?>
<?php $str …
Run Code Online (Sandbox Code Playgroud)

php xml rss

4
推荐指数
1
解决办法
2万
查看次数

在 Laravel 中保存多个图像

我正在尝试将数组中的多个图像保存到数据库中,但我正在努力解决这个问题。我设法能够将多个图像上传到文件夹而不是数据库。

我的控制器

public function store(Request $request)
{

    $content = new Content();

    $request->validate($this->getRules());

    $content->fill($this->getSafeInput($request));

    if($request->hasFile('image'))
    {
        foreach($request->file('image') as $image)
        {
            $destinationPath = 'content_images/';
            $filename = $image->getClientOriginalName();
            $image->move($destinationPath, $filename);
            $content->image = $filename;

        }

    }

    $content->save();

    return redirect()->route('content.index');
}
Run Code Online (Sandbox Code Playgroud)

我的表格

<div class="content-form">
    {{ Form::open(array('route' => 'content.store', 'method' => 'post','files'=>'true' )) }}
        {{ csrf_field() }}

        <div class="form-group">
            <label for="title">Title</label>
            <input type="text" id="title" class="form-control" name="title">
        </div>

        <div class="form-group">
            <input type="file" name="image[]" multiple="multiple">
        </div>

        <input type="submit" class="btn btn-primary" value="Submit"></input>
    {{ Form::close() }}
</div>
Run Code Online (Sandbox Code Playgroud)

laravel laravel-5

1
推荐指数
1
解决办法
8277
查看次数

使用 Dropzone 和 Laravel 获取要上传的图像

我正在尝试创建一个页面,用户可以在其中添加标题,然后上传图像或 2。我正在使用 dropzone 和 Laravel,我试图让它看起来不同,我让它看起来像http:// www.dropzonejs.com/bootstrap.html

我遇到的问题是我需要向 js 文件添加一个 url,但它一直给我这个错误

POST http://crud.test/portfolios 419(状态未知)

并在我的开发工具中的预览中

{消息:“”,异常:“Symfony\Component\HttpKernel\Exception\HttpException”,...}

我知道在 Laravel 中我会使用

{{ csrf_field() }}
Run Code Online (Sandbox Code Playgroud)

并且我无法将图像上传到我在控制器中指定的文件夹或将图像保存到我的数据库中。

我想要的是如何让我的图像上传到文件夹并保存到我的数据库。

我的刀片:

<form action="{{ route('portfolios.store') }}">
    {{ csrf_field() }}

    <div class="form-group">
        <label>Title</label>
        <input type="title" name="title" class="form-control">
    </div>

    <div id="actions" class="row">
        <div class="col-lg-7">
            <span class="btn btn-success fileinput-button dz-clickable">
                <i class="glyphicon glyphicon-plus"></i>
                <span>Add files...</span>
            </span>

            <button type="button" class="btn btn-info start">
                <i class="glyphicon glyphicon-upload"></i>
                <span>Start upload</span>
            </button>

            <button type="reset" class="btn btn-warning cancel">
                <i class="glyphicon glyphicon-ban-circle"></i>
                <span>Cancel upload</span>
            </button>
        </div>

        <div …
Run Code Online (Sandbox Code Playgroud)

laravel dropzone.js laravel-5 dropzone

1
推荐指数
1
解决办法
1207
查看次数

如何忽略 Laravel 中的软删除

我正在尝试运行这个查询

$user= User::where('name', $label)->where('group', $set)->whereNull('deleted_at')->first();
dd($user);
Run Code Online (Sandbox Code Playgroud)

但我总是得到一个空值

laravel

-4
推荐指数
1
解决办法
1万
查看次数

标签 统计

laravel ×3

laravel-5 ×2

dropzone ×1

dropzone.js ×1

php ×1

rss ×1

xml ×1