
基于Laravel开发网站实时评论系统
validate_file_to_edit ( $file, $allowed_files = array() )
validate_file_to_edit: 这个WordPress函数用于在编辑文件之前验证该文件。它检查该文件是否存在,是否可写,是否是一个系统文件,如果发现任何错误,则返回错误信息。
确保请求编辑的文件被允许编辑。
如果你不被允许编辑该文件,该函数将死亡。
function validate_file_to_edit( $file, $allowed_files = array() ) { $code = validate_file( $file, $allowed_files ); if ( ! $code ) { return $file; } switch ( $code ) { case 1: wp_die( __( 'Sorry, that file cannot be edited.' ) ); // case 2 : // wp_die( __('Sorry, cannot call files with their real path.' )); case 3: wp_die( __( 'Sorry, that file cannot be edited.' ) ); } }