暗区突围Ray直装官网,暗区突围国际服下载官方正版

  发布时间:2025-10-28 06:32:03   作者:玩站小弟   我要评论
凋谢注册的度差的文WordPress站点,艰深都市凭证差距品级的距用件规巨细用户脚色来给予差距的权限。文件上传功能便是户脚一个比力罕用的功能,那末,色可上传暗区突围Ray直装官网若何限度差距用户脚色可上传的范及文件规范及巨细呢?下面倡萌就来说说这个下场。让用户具备上传文件的度差的文暗区突围国际服下载官方正版权限默认情景下,有些用户是距用件规巨细不应承上传文件的,你可能在主题的户脚 functions.php 削减下面的代码://应承用户投稿时上传文件 if ( current_user_can(contributor) && !current_user_can(upload_files) ) add_action(admin_init, allow_contributor_uploads); function allow_contributor_uploads() { $contributor = get_role(contributor); $contributor->add_cap(upload_files); } 下面的代码便是给 contributor 这个用户脚色削减了 upload_files (上传文件)的权限。限度用户上传文件的色可上传规范首先,巨匠可能先清晰一下 WordPress 默认应承上传的范及文件规范,掀开WordPress的度差的文 /wp-includes/functions.php 文件,而后搜查 function wp_get_mime_types 定位到那边,距用件规巨细你就会看到详细的户脚暗区突围体验服下载文件规范:function wp_get_mime_types() { // Accepted MIME types are set here as PCRE unless provided. return apply_filters( mime_types, array( // Image formats jpg|jpeg|jpe => image/jpeg, gif => image/gif, png => image/png, bmp => image/bmp, tif|tiff => image/tiff, ico => image/x-icon, // Video formats asf|asx|wax|wmv|wmx => video/asf, avi => video/avi, divx => video/divx, flv => video/x-flv, mov|qt => video/quicktime, mpeg|mpg|mpe => video/mpeg, mp4|m4v => video/mp4, ogv => video/ogg, mkv => video/x-matroska, // Text formats txt|asc|c|cc|h => text/plain, csv => text/csv, tsv => text/tab-separated-values, ics => text/calendar, rtx => text/richtext, css => text/css, htm|html => text/html, // Audio formats mp3|m4a|m4b => audio/mpeg, ra|ram => audio/x-realaudio, wav => audio/wav, ogg|oga => audio/ogg, mid|midi => audio/midi, wma => audio/wma, mka => audio/x-matroska, // Misc application formats rtf => application/rtf, js => application/javascript, pdf => application/pdf, swf => application/x-shockwave-flash, class => application/java, tar => application/x-tar, zip => application/zip, gz|gzip => application/x-gzip, rar => application/rar, 7z => application/x-7z-compressed, exe => application/x-msdownload, // MS Office formats doc => application/msword, pot|pps|ppt => application/vnd.ms-powerpoint, wri => application/vnd.ms-write, xla|xls|xlt|xlw => application/vnd.ms-excel, mdb => application/vnd.ms-access, mpp => application/vnd.ms-project, docx => application/vnd.openxmlformats-officedocument.wordprocessingml.document, docm => application/vnd.ms-word.document.macroEnabled.12, dotx => application/vnd.openxmlformats-officedocument.wordprocessingml.template, dotm => application/vnd.ms-word.template.macroEnabled.12, xlsx => application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, xlsm => application/vnd.ms-excel.sheet.macroEnabled.12, xlsb => application/vnd.ms-excel.sheet.binary.macroEnabled.12, xltx => application/vnd.openxmlformats-officedocument.spreadsheetml.template, xltm => application/vnd.ms-excel.template.macroEnabled.12, xlam => application/vnd.ms-excel.addin.macroEnabled.12, pptx => application/vnd.openxmlformats-officedocument.presentationml.presentation, pptm => application/vnd.ms-powerpoint.presentation.macroEnabled.12, ppsx => application/vnd.openxmlformats-officedocument.presentationml.slideshow, ppsm => application/vnd.ms-powerpoint.slideshow.macroEnabled.12, potx => application/vnd.openxmlformats-officedocument.presentationml.template, potm => application/vnd.ms-powerpoint.template.macroEnabled.12, ppam => application/vnd.ms-powerpoint.addin.macroEnabled.12, sldx => application/vnd.openxmlformats-officedocument.presentationml.slide, sldm => application/vnd.ms-powerpoint.slide.macroEnabled.12, onetoc|onetoc2|onetmp|onepkg => application/onenote, // OpenOffice formats odt => application/vnd.oasis.opendocument.text, odp => application/vnd.oasis.opendocument.presentation, ods => application/vnd.oasis.opendocument.spreadsheet, odg => application/vnd.oasis.opendocument.graphics, odc => application/vnd.oasis.opendocument.chart, odb => application/vnd.oasis.opendocument.database, odf => application/vnd.oasis.opendocument.formula, // WordPerfect formats wp|wpd => application/wordperfect, ) ); } => 的前面为格式,前面为格式形貌。色可上传假如你要防止上传其中的范及某些规范,可能参考下面的暗区突围ray例子:将下面的代码削减到主题的 functions.php 文件://防止上传avi以及mp4格式的文件 add_filter(upload_mimes, custom_upload_mimes); function custom_upload_mimes ( $existing_mimes=array() ) { unset ($existing_mimes[avi]); unset ($existing_mimes[mp4]); return $existing_mimes; } 假如你还要防止更多,可能凭证 unset ($existing_mimes[格式]);  样例削减即可。假如你仅仅惟独要应承用户上传多少种规范而已经,还可能经由下面的暗区突围ray直装教程更简洁的措施,代码削减到主题的 functions.php 文件://只应承上传图片文件 add_filter(upload_mimes, custom_upload_mimes); function custom_upload_mimes ( $existing_mimes=array() ) { unset ($existing_mimes);//防止上传任何文件 $existing_mimes[jpg|jpeg|gif|png]=image/image;//应承用户上传jpg,gif,png文件 return $existing_mimes; } 假如你还要应承上传其余格式,一再运用 $existing_mimes[格式]=形貌;  即可。限度用户上传的暗区突围Ray防封端口文件巨细同样在主题的 functions.php 文件中,削减下面的代码://限度上传文件的最概况积 function max_up_size() { return 500*1024; // 500 kb } add_filter(upload_size_limit, max_up_size); 下面的例子是限度所实用户上传的文件的最概况积为 500 kb (1M =1024*1024)。留意:主机空间以及WordPress自己艰深配置了应承上传的文件的最概况积,以是暗区突围ray直装怎么下载在这里配置需要思考到这点。限度差距用户脚色可上传的文件规范及巨细着实下面已经给出了限度规范以及巨细的措施,要凭证差距用户脚色来限度,惟独要削减脚色分说代码即可。暗区突围RAY官网倡萌举个综合的例子://差距用户上传的规范 function custom_upload_mimes ( $existing_mimes=array() ) { unset ($existing_mimes);//防止上传任何文件 if( current_user_can( publish_posts ) && !current_user_can( publish_pages ) ) { //应承作者(Author)上传的规范 $existing_mimes[jpg|jpeg|gif|png]=image/image;//应承用户上传jpg,gif,png文件 $existing_mimes[zip]=application/zip; //应承用户上传zip缩短包 $existing_mimes[pdf]=application/pdf; //应承用户上传pdf文件 }elseif( current_user_can( edit_posts ) && !current_user_can( publish_posts ) ) { //应承投稿者(Contributor)上传的规范 $existing_mimes[jpg|jpeg|gif|png]=image/image; $existing_mimes[pdf]=application/pdf; }else{ //其余用户脚色上传的规范 $existing_mimes[jpg|jpeg|gif|png]=image/image; } return $existing_mimes; } //差距用户上传的巨细 function max_up_size() { if( current_user_can( publish_posts ) && !current_user_can( publish_pages ) ) { return 2048*1024; // 应承作者(Author)上传 2M }elseif( current_user_can( edit_posts ) && !current_user_can( publish_posts ) ) { return 1024*1024; // 应承投稿者(Contributor)上传 1M }else{ return 500*1024; // 其余用户脚色上传 500 kb } } //只对于非规画员实施这两个函数(即:对于规画员不失效) if( !current_user_can( manage_options ) ) { add_filter(upload_mimes, custom_upload_mimes); add_filter(upload_size_limit, max_up_size); }。

凋谢注册的度差的文WordPress站点,艰深都市凭证差距品级的距用件规巨细用户脚色来给予差距的权限。文件上传功能便是户脚一个比力罕用的功能 ,那末,色可上传暗区突围Ray直装官网若何限度差距用户脚色可上传的范及文件规范及巨细呢 ?下面倡萌就来说说这个下场。

让用户具备上传文件的度差的文暗区突围国际服下载官方正版权限

默认情景下  ,有些用户是距用件规巨细不应承上传文件的,你可能在主题的户脚 functions.php 削减下面的代码 :

暗区突围Ray直装官网,暗区突围国际服下载官方正版

//应承用户投稿时上传文件 if ( current_user_can(contributor) && !current_user_can(upload_files) ) add_action(admin_init, allow_contributor_uploads); function allow_contributor_uploads() { $contributor = get_role(contributor); $contributor->add_cap(upload_files); }

下面的代码便是给 contributor 这个用户脚色削减了 upload_files (上传文件)的权限。

限度用户上传文件的色可上传规范

首先,巨匠可能先清晰一下 WordPress 默认应承上传的范及文件规范 ,掀开WordPress的度差的文 /wp-includes/functions.php 文件 ,而后搜查 function wp_get_mime_types 定位到那边 ,距用件规巨细你就会看到详细的户脚暗区突围体验服下载文件规范:

function wp_get_mime_types() { // Accepted MIME types are set here as PCRE unless provided. return apply_filters( mime_types, array( // Image formats jpg|jpeg|jpe => image/jpeg, gif => image/gif, png => image/png, bmp => image/bmp, tif|tiff => image/tiff, ico => image/x-icon, // Video formats asf|asx|wax|wmv|wmx => video/asf, avi => video/avi, divx => video/divx, flv => video/x-flv, mov|qt => video/quicktime, mpeg|mpg|mpe => video/mpeg, mp4|m4v => video/mp4, ogv => video/ogg, mkv => video/x-matroska, // Text formats txt|asc|c|cc|h => text/plain, csv => text/csv, tsv => text/tab-separated-values, ics => text/calendar, rtx => text/richtext, css => text/css, htm|html => text/html, // Audio formats mp3|m4a|m4b => audio/mpeg, ra|ram => audio/x-realaudio, wav => audio/wav, ogg|oga => audio/ogg, mid|midi => audio/midi, wma => audio/wma, mka => audio/x-matroska, // Misc application formats rtf => application/rtf, js => application/javascript, pdf => application/pdf, swf => application/x-shockwave-flash, class => application/java, tar => application/x-tar, zip => application/zip, gz|gzip => application/x-gzip, rar => application/rar, 7z => application/x-7z-compressed, exe => application/x-msdownload, // MS Office formats doc => application/msword, pot|pps|ppt => application/vnd.ms-powerpoint, wri => application/vnd.ms-write, xla|xls|xlt|xlw => application/vnd.ms-excel, mdb => application/vnd.ms-access, mpp => application/vnd.ms-project, docx => application/vnd.openxmlformats-officedocument.wordprocessingml.document, docm => application/vnd.ms-word.document.macroEnabled.12, dotx => application/vnd.openxmlformats-officedocument.wordprocessingml.template, dotm => application/vnd.ms-word.template.macroEnabled.12, xlsx => application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, xlsm => application/vnd.ms-excel.sheet.macroEnabled.12, xlsb => application/vnd.ms-excel.sheet.binary.macroEnabled.12, xltx => application/vnd.openxmlformats-officedocument.spreadsheetml.template, xltm => application/vnd.ms-excel.template.macroEnabled.12, xlam => application/vnd.ms-excel.addin.macroEnabled.12, pptx => application/vnd.openxmlformats-officedocument.presentationml.presentation, pptm => application/vnd.ms-powerpoint.presentation.macroEnabled.12, ppsx => application/vnd.openxmlformats-officedocument.presentationml.slideshow, ppsm => application/vnd.ms-powerpoint.slideshow.macroEnabled.12, potx => application/vnd.openxmlformats-officedocument.presentationml.template, potm => application/vnd.ms-powerpoint.template.macroEnabled.12, ppam => application/vnd.ms-powerpoint.addin.macroEnabled.12, sldx => application/vnd.openxmlformats-officedocument.presentationml.slide, sldm => application/vnd.ms-powerpoint.slide.macroEnabled.12, onetoc|onetoc2|onetmp|onepkg => application/onenote, // OpenOffice formats odt => application/vnd.oasis.opendocument.text, odp => application/vnd.oasis.opendocument.presentation, ods => application/vnd.oasis.opendocument.spreadsheet, odg => application/vnd.oasis.opendocument.graphics, odc => application/vnd.oasis.opendocument.chart, odb => application/vnd.oasis.opendocument.database, odf => application/vnd.oasis.opendocument.formula, // WordPerfect formats wp|wpd => application/wordperfect, ) ); }

=> 的前面为格式 ,前面为格式形貌。色可上传假如你要防止上传其中的范及某些规范,可能参考下面的暗区突围ray例子:

将下面的代码削减到主题的 functions.php 文件:

//防止上传avi以及mp4格式的文件 add_filter(upload_mimes, custom_upload_mimes); function custom_upload_mimes ( $existing_mimes=array() ) { unset ($existing_mimes[avi]); unset ($existing_mimes[mp4]); return $existing_mimes; }

假如你还要防止更多 ,可能凭证 unset ($existing_mimes[格式]);  样例削减即可 。

假如你仅仅惟独要应承用户上传多少种规范而已经,还可能经由下面的暗区突围ray直装教程更简洁的措施,代码削减到主题的 functions.php 文件 :

//只应承上传图片文件 add_filter(upload_mimes, custom_upload_mimes); function custom_upload_mimes ( $existing_mimes=array() ) { unset ($existing_mimes);//防止上传任何文件 $existing_mimes[jpg|jpeg|gif|png]=image/image;//应承用户上传jpg,gif,png文件 return $existing_mimes; }

假如你还要应承上传其余格式,一再运用 $existing_mimes[格式]=形貌;  即可。

限度用户上传的暗区突围Ray防封端口文件巨细

同样在主题的 functions.php 文件中 ,削减下面的代码:

//限度上传文件的最概况积 function max_up_size() { return 500*1024; // 500 kb } add_filter(upload_size_limit, max_up_size);

下面的例子是限度所实用户上传的文件的最概况积为 500 kb (1M =1024*1024) 。

留意 :主机空间以及WordPress自己艰深配置了应承上传的文件的最概况积,以是暗区突围ray直装怎么下载在这里配置需要思考到这点 。

限度差距用户脚色可上传的文件规范及巨细

着实下面已经给出了限度规范以及巨细的措施 ,要凭证差距用户脚色来限度 ,惟独要削减脚色分说代码即可。暗区突围RAY官网倡萌举个综合的例子 :

//差距用户上传的规范 function custom_upload_mimes ( $existing_mimes=array() ) { unset ($existing_mimes);//防止上传任何文件 if( current_user_can( publish_posts ) && !current_user_can( publish_pages ) ) { //应承作者(Author)上传的规范 $existing_mimes[jpg|jpeg|gif|png]=image/image;//应承用户上传jpg,gif,png文件 $existing_mimes[zip]=application/zip; //应承用户上传zip缩短包 $existing_mimes[pdf]=application/pdf; //应承用户上传pdf文件 }elseif( current_user_can( edit_posts ) && !current_user_can( publish_posts ) ) { //应承投稿者(Contributor)上传的规范 $existing_mimes[jpg|jpeg|gif|png]=image/image; $existing_mimes[pdf]=application/pdf; }else{ //其余用户脚色上传的规范 $existing_mimes[jpg|jpeg|gif|png]=image/image; } return $existing_mimes; } //差距用户上传的巨细 function max_up_size() { if( current_user_can( publish_posts ) && !current_user_can( publish_pages ) ) { return 2048*1024; // 应承作者(Author)上传 2M }elseif( current_user_can( edit_posts ) && !current_user_can( publish_posts ) ) { return 1024*1024; // 应承投稿者(Contributor)上传 1M }else{ return 500*1024; // 其余用户脚色上传 500 kb } } //只对于非规画员实施这两个函数(即  :对于规画员不失效) if( !current_user_can( manage_options ) ) { add_filter(upload_mimes, custom_upload_mimes); add_filter(upload_size_limit, max_up_size); }

相关文章

  • 软件产品介绍官网单页HTML源码

    源码介绍软件产品介绍官网HTML源码,适合用于app下载官网,界面ui还挺好看的 ,支持多个下载按钮 ,软件介绍,电脑手机端自适应。无加密免费使用  。下载地址此处内容需要回复后才能查看
    2025-10-28
  • 环形战争官网版

    环形战争官网版是一款以欧洲中世纪战争为题材的策略回合制手游 ,这里汇集了各种各样的元素,在游戏中玩家需要去招募各种差异的兵种 ,参与到每一次的战争中,书写自己的传奇故事,融入众多独特的元素 ,感兴趣的玩家快
    2025-10-28
  • 猫宅97官方版

    猫宅97官方版是一款清新靓丽的模拟经营类游戏。众多各种各样可爱的猫咪,玩家要照顾它们的起居日食,与猫咪互动 ,按照自己的喜好建造小屋 ,给自己心爱的小猫咪们住,喜爱这款游戏的小伙伴们快来本站下载体验吧~~
    2025-10-28
  • 你是什么鸭手机版

    你是什么鸭手机版是一款简笔画风格的休闲益智游戏 。从一只一般的鸭子起始培养,寻找食物和宝物,并培养它们成长,还可以对小鸭子进行调整和选择,并解决各种谜题 ,而每个孵化出来的鸭子都会带来惊喜和乐趣。你是什么
    2025-10-28
  • 宝塔面板最新8.0.0开心版企业功能免费

    程序介绍本脚本未加密,有没有后门大家自己看就知道了 ,仅仅将官方的脚本本地化了 ,未经任何修改,请放心使用!本次脚本支持 :Centos 7 、Debian、Ubuntu、Fedora!注意事项问 :为什么企业
    2025-10-28
  • 抖音推流是怎么推的,0元下单 专区 - 回森业务下单 - 1元秒刷1000粉

    什么是永久QQ会员 ?QQ会员是QQ官方推出的一项收费服务 ,用户选购后可以享受到一系列的特权,如:QQ等级加速、QQ秀使用特权 、游戏充值折扣 、视频会员等等 。而永久QQ会员则是指一次性选购 ,就可以享受到永
    2025-10-28

最新评论