PHP file_get_contents返回布尔值(false)

时间:2019-01-07 21:30:27

标签: php json

我正在尝试将class PostApplication < ApplicationRecord include Friendlyable belongs_to :user enum status: { pending: 'pending', accepted: 'accepted', denied: 'denied' }, _prefix: :status end 文件的内容保存到class AdminApplicantsController < ApplicationController before_action :authenticate_admin! def index @posts = Kaminari.paginate_array(current_admin.posts.collect(&:post_applications).flatten).page(params[:page]).per(15) end def update_application_status @post = PostApplication.find(params[:id]) permitted_columns = params.require(:post).permit(:is_application_reviewed, :status) if @post.update_attributes(permitted_columns) flash[:success] = "#{@post.first_name}'s Application Status Updated!" redirect_to admin_applicants_path else flash[:danger] = "#{@post.first_name}'s failed to update! Try again" redirect_to admin_applicants_path end end end ,然后转换为 resources :admin_applicants, :only => [:index] do post :update_application_status end 。但是,XML无法读取我上传的文件,因为它返回了string。我确实读过关于同一问题的其他文章,但是它们的文件路径是URL。有人知道导致此错误的原因吗?

JSON

1 个答案:

答案 0 :(得分:1)

您必须使用$_FILES['xml']['tmp_name']