Laravel项目无法访问

时间:2017-05-19 18:12:34

标签: php laravel

我已将项目上传到Laravel,但该网站未显示。我收到以下错误日志:

[19-May-2017 17:47:38 UTC] PHP Fatal error:  Interface 'JsonSerializable' not found in /home/behnamha/fueltrans.behnamhadipanah.ir/core/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 18

[19-May-2017 17:47:38 UTC] PHP Fatal error:  Interface 'JsonSerializable' not found in /home/behnamha/fueltrans.behnamhadipanah.ir/core/vendor/laravel/framework/src/Illuminate/Support/Collection.php on line 19

来源:screenshot of the error

的成绩单

1 个答案:

答案 0 :(得分:0)

启用php-json

如果您可以访问服务器,请检查它是否已激活/已安装

执行命令

conString = string.Format(conString, excelPath);

using (OleDbConnection excel_con = new OleDbConnection(conString))
{
    excel_con.Open();

    string sheet1 = excel_con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null).Rows[0]["TABLE_NAME"].ToString();
    DataTable dtExcelData = new DataTable();

    //[OPTIONAL]: It is recommended as otherwise the data will be considered as String by default.
    dtExcelData.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)),
    new DataColumn("Name", typeof(int)),
    new DataColumn("Salary",typeof(decimal)) });

    using (OleDbDataAdapter oda = new OleDbDataAdapter("SELECT * FROM [" + sheet1 + "]", excel_con))
    {
        oda.Fill(dtExcelData);
    }

    excel_con.Close();

    string consString = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;

    using (SqlConnection con = new SqlConnection(consString))
    {
        using (SqlBulkCopy sqlBulkCopy = new SqlBulkCopy(con))
        {
            //Set the database table name
            sqlBulkCopy.DestinationTableName = "dbo.tblPerson";

            //[OPTIONAL]: Map the Excel columns with that of the database table
            sqlBulkCopy.ColumnMappings.Add("Id", "PersonId");
            sqlBulkCopy.ColumnMappings.Add("Name", "Name");
            sqlBulkCopy.ColumnMappings.Add("Salary", "Salary");

            con.Open();
            sqlBulkCopy.WriteToServer(dtExcelData);
            con.Close();
        }
    }
}

您应该在回复的底部看到以下内容:

php --re "json"

您还可以查看配置。 我在php 7.1上使用php-fpm并转到此处:- Classes [1] { Interface [ <internal:json> interface JsonSerializable ] { - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [0] { } - Methods [1] { Method [ <internal:json> abstract public method jsonSerialize ] { - Parameters [0] { } } } } }

这可能会因您的配置而异,但您应该看到

的内容
/etc/php/7.1/fpm/conf.d