echo upload_path: .get_option( uploa" name="description" /> echo upload_path: .get_option( uploa" />

常用函数-wp_upload_dir()

用法

<?php$wud = wp_upload_dir();$old = wp_upload_dir( '2007-11-26 04:26:39' );echo 'uploads_use_yearmonth_folders: '.get_option( 'uploads_use_yearmonth_folders' )."\n";echo 'upload_path: ' .get_option( 'upload_path' )."\n";echo 'upload_url_path: ' .get_option( 'upload_url_path' )."\n";print_r($old);print_r($wud);?>

返回的值

返回的字段包括: [path], [url], [subdir], [basedir], [baseurl], [error]

若成功,返回的数组会有多个索引:'path' —— 基文件夹与子文件夹,或上传文件夹的完全路径。'url' —— 基ur与子文件夹,或上传文件夹的绝对路径。'subdir' —— 子文件夹。'basedir' —— 没有子文件夹的路径。'baseurl' ——没有子文件夹的URL路径。'error' —— 设为false。

WordPress2.6后可返回[basedir] 与[baseurl]字段。

示例

uploads_use_yearmonth_folders: 1upload_path: /home/example.com/wordpress/wp-content/uploadsupload_url_path: http://www.example.com/wordpress/wp-content/uploadsArray(    [path] => /home/example.com/wordpress/wp-content/uploads/2007/11    [url] => http://www.example.com/wordpress/wp-content/uploads/2007/11    [subdir] => /2007/11    [basedir] => /home/example.com/wordpress/wp-content/uploads    [baseurl] => http://www.example.com/wordpress/wp-content/uploads    [error] => )Array(    [path] => /home/example.com/wordpress/wp-content/uploads/2008/11    [url] => http://www.example.com/wordpress/wp-content/uploads/2008/11    [subdir] => /2008/11    [basedir] => /home/example.com/wordpress/wp-content/uploads    [baseurl] => http://www.example.com/wordpress/wp-content/uploads    [error] => )

人吐槽 人点赞

猜你喜欢

发表评论

用户名: 密码:
验证码: 匿名发表

你可以使用这些语言

查看评论:常用函数-wp_upload_dir()