date() expects at least 1 parameter, 0 given

在使用ThinkPHP6进行文件上传时,遇到使用date命名规则报错,原因是date函数需要参数。解决方法是改为使用自定义函数处理文件命名,或者按照date规则传入必要的日期参数。

使用thinkPHP6 做文件上传时,TP封装了三种命名规则,使用sha1/md5时,都没问题;但在使用date命名规则时,却报错提示缺少参数。

目录

代码如下: 

报错如下:

原因:

解决方法:

总结


 

代码如下: 

$savename = \think\facade\Filesystem::disk('public')
            ->putFile('topic', $file,'date');

print_r($savename);die;

报错如下:

 

 

原因:

经过查看源码和多次测试,发现使用md5/sha1命名规则时,是第一个case进行处理,而当设置date时,使用的是第二个case,它会去调用date函数并返回结果,date函数使用时,必须至少有一个参数。

官方文档中date命名规则的解释是:根据日期和微秒数生成。

原来dafault就是date命名规则,而我设置date就会命中第二个case,

这个封装方法的用法是自定义函数命名规则,就是自己写一个函数传进来进行调用。

解决方法:

Date就是这样的命名规则,如果觉得不好用,就改成自定义函数处理上传文件的命名。

可以在原来的基础上改;也可以写一个公共函数,修改第三个参数为你的自定义函数名称。

如:

$savename = \think\facade\Filesystem::disk('public')
            ->putFile('topic', $data['skill_img'],'自定义函数名称');

总结

这个不是bug,只是对使用习惯和框架了解不足的原因。

Linking files for Subswath 1 ... Linking files for Subswath 2 ... Linking files for Subswath 3 ... [1] 22215 [2] 22216 [3] 22217 [3] - Done p2p_processing.csh S1_TOPS ... [2] - Done p2p_processing.csh S1_TOPS ... [1] + Done p2p_processing.csh S1_TOPS ... *** buffer overflow detected ***: terminated Aborted (core dumped) *** buffer overflow detected ***: terminated Aborted (core dumped) *** buffer overflow detected ***: terminated Aborted (core dumped) Merging START Number of Files to be merged is 3 merge_swath [ERROR]: Cannot find file ../F1/intf/2025056_2025104/phasefilt.grd merge_swath [ERROR]: Cannot find file ../F1/intf/2025056_2025104/phasefilt.grd merge_swath [ERROR]: File ../F1/intf/2025056_2025104/phasefilt.grd not found [Session merge_swath (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) cannot open grids ../F1/intf/2025056_2025104/phasefilt.grd Number of Files to be merged is 3 merge_swath [ERROR]: Cannot find file ../F1/intf/2025056_2025104/corr.grd merge_swath [ERROR]: Cannot find file ../F1/intf/2025056_2025104/corr.grd merge_swath [ERROR]: File ../F1/intf/2025056_2025104/corr.grd not found [Session merge_swath (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) cannot open grids ../F1/intf/2025056_2025104/corr.grd Number of Files to be merged is 3 merge_swath [ERROR]: Cannot find file ../F1/intf/2025056_2025104/mask.grd merge_swath [ERROR]: Cannot find file ../F1/intf/2025056_2025104/mask.grd merge_swath [ERROR]: File ../F1/intf/2025056_2025104/mask.grd not found [Session merge_swath (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) cannot open grids ../F1/intf/2025056_2025104/mask.grd Merging END Recomputing the projection LUT... grep: S1_20250226_113936_F1.PRM: 没有那个文件或目录 error - could not open file S1_20250226_113936_F1.PRM couldn't open master.PRM Usage: SAT_llt2rat master.PRM prec [-bo[s|d]] < inputfile > outputfile master.PRM - parameter file for master image and points to LED orbit file precise - (0) standard back geocoding, (1) - polynomial refinenent (slower) inputfile - lon, lat, elevation [ASCII] outputfile - range, azimuth, elevation(ref to radius in PRM), lon, lat [ASCII default] -bos or -bod - binary single or double precision output (only output results within data coverage, PRM num_lines, num_rng_bins ) example: SAT_llt2rat master.PRM 0 < topo.llt > topo.ratll error - could not open file S1_20250226_113936_F1.PRM grdinfo [ERROR]: Cannot find file phasefilt.grd grdinfo [ERROR]: Must specify one or more input files Usage: landmask.csh region_cut[0/10600/0/27648] make a landmask in radar coordinates, needs to run with trans.dat NOTE: The region_cut can be specified in batch.config file SNAPHU.CSH - START threshold_snaphu: 0.1 grdmath [ERROR]: corr_patch.grd is not a number, operator or file name grdmath [ERROR]: corr_patch.grd is not a number, operator or file name grdmath [ERROR]: mask2_patch.grd is not a number, operator or file name grd2xyz [ERROR]: Cannot find file phase_patch.grd grd2xyz [ERROR]: Cannot find file phase_patch.grd grd2xyz [ERROR]: File phase_patch.grd not found [Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) grd2xyz [ERROR]: Cannot find file corr_tmp.grd grd2xyz [ERROR]: Cannot find file corr_tmp.grd grd2xyz [ERROR]: File corr_tmp.grd not found [Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) unwrapping phase with snaphu - higher threshold for faster unwrapping grdinfo [ERROR]: Cannot find file phase_patch.grd grdinfo [ERROR]: Must specify one or more input files snaphu v2.0.4 32 parameters input from file /usr/local/GMTSAR/share/gmtsar/snaphu/config/snaphu.conf.brief (297 lines total) not enough input arguments. type snaphu -h for help grdinfo [ERROR]: Cannot find file phase_patch.grd grdinfo [ERROR]: Must specify one or more input files grdinfo [ERROR]: Cannot find file phase_patch.grd grdinfo [ERROR]: Must specify one or more input files xyz2grd [ERROR]: Must specify -R option xyz2grd [ERROR]: Option -I: Must specify positive increment(s) grdinfo [ERROR]: Cannot find file phase_patch.grd grdinfo [ERROR]: Must specify one or more input files grdinfo [ERROR]: Cannot find file phase_patch.grd grdinfo [ERROR]: Must specify one or more input files xyz2grd [ERROR]: Must specify -R option xyz2grd [ERROR]: Option -I: Must specify positive increment(s) grdmath [ERROR]: tmp.grd is not a number, operator or file name mv: 对 'tmp.grd' 调用 stat 失败: 没有那个文件或目录 grdgradient [ERROR]: Cannot find file unwrap.grd grdinfo [ERROR]: Cannot find file unwrap.grd grdinfo [ERROR]: Must specify one or more input files makecpt [ERROR]: Option T: Must specify valid min[/max[/inc[<unit>|+n]]] option grdimage [ERROR]: Cannot find file unwrap.grd grdimage [ERROR]: Option -I: Must specify intensity file, value, or modifiers psscale [WARNING]: No country code matching unwrap.grd (skipped) psscale [ERROR]: Color palette table unwrap.cpt is empty [Session gmt (0)]: Error returned from GMT API: GMT_CPT_READ_ERROR (8) [Session gmt (0)]: Error returned from GMT API: GMT_CPT_READ_ERROR (8) psconvert [ERROR]: The file unwrap.ps has no BoundingBox in the first 20 lines or last 256 bytes. Use -A option. Unwrapped phase map: unwrap.pdf SNAPHU.CSH - END GEOCODE-START proj_ra2ll.csh grd2xyz [ERROR]: Cannot find file phasefilt.grd grd2xyz [ERROR]: Cannot find file phasefilt.grd grd2xyz [ERROR]: File phasefilt.grd not found [Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) gmtinfo [ERROR]: No input data found! surface [ERROR]: Must specify -R option surface [INFORMATION]: Provides 5, expects 3-column binary data surface [ERROR]: Must specify -R option surface [INFORMATION]: Provides 5, expects 3-column binary data grdtrack [ERROR]: Cannot find file raln.grd grdtrack [ERROR]: Cannot find file ralt.grd grdtrack [ERROR]: Must specify -G at least once gmtconvert [WARNING]: File <stdin> is empty! gmtconvert [WARNING]: No data records provided Sampling in geocoordinates with 50 meter pixels ... gmtinfo [ERROR]: No input data found! range: Subscript out of range. gmtmath [ERROR]: Operation "DIV" requires 2 operands gmtmath [ERROR]: Operation "MUL" requires 2 operands gmtinfo [ERROR]: No input data found! blockmedian [ERROR]: Unable to decode as a floating point number blockmedian [ERROR]: Option -I parsing failure. Correct syntax: -I<xinc>[+e|n][/<yinc>[+e|n]] Specify increment(s) and optionally append units or modifiers. For geographic regions in degrees you can optionally append units from this list: (d)egree [Default], (m)inute, (s)econd, m(e)ter, (f)oot, (k)ilometer, (M)ile, (n)autical mile, s(u)rvey foot. +e Adjust the region to fit increments [Adjust increment to fit domain]. +n Increment specifies the number of nodes instead. Then, the actual increments are calculated from the given domain and node- registration settings (see Appendix B for details). Note: If -R<grdfile> was used then -I (and -R and maybe -r) have been set; use -I to override those increments. blockmedian [ERROR]: Must specify -R option blockmedian [ERROR]: Option -I: Must specify positive increment(s) blockmedian [INFORMATION]: Provides 3, expects 3-column binary data xyz2grd [ERROR]: Unable to decode as a floating point number xyz2grd [ERROR]: Option -I parsing failure. Correct syntax: -I<xinc>[+e|n][/<yinc>[+e|n]] Specify increment(s) and optionally append units or modifiers. For geographic regions in degrees you can optionally append units from this list: (d)egree [Default], (m)inute, (s)econd, m(e)ter, (f)oot, (k)ilometer, (M)ile, (n)autical mile, s(u)rvey foot. +e Adjust the region to fit increments [Adjust increment to fit domain]. +n Increment specifies the number of nodes instead. Then, the actual increments are calculated from the given domain and node- registration settings (see Appendix B for details). Note: If -R<grdfile> was used then -I (and -R and maybe -r) have been set; use -I to override those increments. xyz2grd [ERROR]: Must specify -R option xyz2grd [ERROR]: Option -I: Must specify positive increment(s) grdmath [ERROR]: corr.grd is not a number, operator or file name grdmath [ERROR]: phasefilt.grd is not a number, operator or file name proj_ra2ll.csh grd2xyz [ERROR]: Cannot find file phasefilt_mask.grd grd2xyz [ERROR]: Cannot find file phasefilt_mask.grd grd2xyz [ERROR]: File phasefilt_mask.grd not found [Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) gmtinfo [ERROR]: No input data found! surface [ERROR]: Must specify -R option surface [INFORMATION]: Provides 5, expects 3-column binary data surface [ERROR]: Must specify -R option surface [INFORMATION]: Provides 5, expects 3-column binary data grdtrack [ERROR]: Cannot find file raln.grd grdtrack [ERROR]: Cannot find file ralt.grd grdtrack [ERROR]: Must specify -G at least once gmtconvert [WARNING]: File <stdin> is empty! gmtconvert [WARNING]: No data records provided Sampling in geocoordinates with 50 meter pixels ... gmtinfo [ERROR]: No input data found! range: Subscript out of range. gmtmath [ERROR]: Operation "DIV" requires 2 operands gmtmath [ERROR]: Operation "MUL" requires 2 operands gmtinfo [ERROR]: No input data found! blockmedian [ERROR]: Unable to decode as a floating point number blockmedian [ERROR]: Option -I parsing failure. Correct syntax: -I<xinc>[+e|n][/<yinc>[+e|n]] Specify increment(s) and optionally append units or modifiers. For geographic regions in degrees you can optionally append units from this list: (d)egree [Default], (m)inute, (s)econd, m(e)ter, (f)oot, (k)ilometer, (M)ile, (n)autical mile, s(u)rvey foot. +e Adjust the region to fit increments [Adjust increment to fit domain]. +n Increment specifies the number of nodes instead. Then, the actual increments are calculated from the given domain and node- registration settings (see Appendix B for details). Note: If -R<grdfile> was used then -I (and -R and maybe -r) have been set; use -I to override those increments. blockmedian [ERROR]: Must specify -R option blockmedian [ERROR]: Option -I: Must specify positive increment(s) blockmedian [INFORMATION]: Provides 3, expects 3-column binary data xyz2grd [ERROR]: Unable to decode as a floating point number xyz2grd [ERROR]: Option -I parsing failure. Correct syntax: -I<xinc>[+e|n][/<yinc>[+e|n]] Specify increment(s) and optionally append units or modifiers. For geographic regions in degrees you can optionally append units from this list: (d)egree [Default], (m)inute, (s)econd, m(e)ter, (f)oot, (k)ilometer, (M)ile, (n)autical mile, s(u)rvey foot. +e Adjust the region to fit increments [Adjust increment to fit domain]. +n Increment specifies the number of nodes instead. Then, the actual increments are calculated from the given domain and node- registration settings (see Appendix B for details). Note: If -R<grdfile> was used then -I (and -R and maybe -r) have been set; use -I to override those increments. xyz2grd [ERROR]: Must specify -R option xyz2grd [ERROR]: Option -I: Must specify positive increment(s) proj_ra2ll.csh grd2xyz [ERROR]: Cannot find file corr.grd grd2xyz [ERROR]: Cannot find file corr.grd grd2xyz [ERROR]: File corr.grd not found [Session gmt (0)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16) gmtinfo [ERROR]: No input data found! surface [ERROR]: Must specify -R option surface [INFORMATION]: Provides 5, expects 3-column binary data surface [ERROR]: Must specify -R option surface [INFORMATION]: Provides 5, expects 3-column binary data grdtrack [ERROR]: Cannot find file raln.grd grdtrack [ERROR]: Cannot find file ralt.grd grdtrack [ERROR]: Must specify -G at least once gmtconvert [WARNING]: File <stdin> is empty! gmtconvert [WARNING]: No data records provided Sampling in geocoordinates with 50 meter pixels ... gmtinfo [ERROR]: No input data found! range: Subscript out of range. gmtmath [ERROR]: Operation "DIV" requires 2 operands gmtmath [ERROR]: Operation "MUL" requires 2 operands gmtinfo [ERROR]: No input data found! blockmedian [ERROR]: Unable to decode as a floating point number blockmedian [ERROR]: Option -I parsing failure. Correct syntax: -I<xinc>[+e|n][/<yinc>[+e|n]] Specify increment(s) and optionally append units or modifiers. For geographic regions in degrees you can optionally append units from this list: (d)egree [Default], (m)inute, (s)econd, m(e)ter, (f)oot, (k)ilometer, (M)ile, (n)autical mile, s(u)rvey foot. +e Adjust the region to fit increments [Adjust increment to fit domain]. +n Increment specifies the number of nodes instead. Then, the actual increments are calculated from the given domain and node- registration settings (see Appendix B for details). Note: If -R<grdfile> was used then -I (and -R and maybe -r) have been set; use -I to override those increments. blockmedian [ERROR]: Must specify -R option blockmedian [ERROR]: Option -I: Must specify positive increment(s) blockmedian [INFORMATION]: Provides 3, expects 3-column binary data xyz2grd [ERROR]: Unable to decode as a floating point number xyz2grd [ERROR]: Option -I parsing failure. Correct syntax: -I<xinc>[+e|n][/<yinc>[+e|n]] Specify increment(s) and optionally append units or modifiers. For geographic regions in degrees you can optionally append units from this list: (d)egree [Default], (m)inute, (s)econd, m(e)ter, (f)oot, (k)ilometer, (M)ile, (n)autical mile, s(u)rvey foot. +e Adjust the region to fit increments [Adjust increment to fit domain]. +n Increment specifies the number of nodes instead. Then, the actual increments are calculated from the given domain and node- registration settings (see Appendix B for details). Note: If -R<grdfile> was used then -I (and -R and maybe -r) have been set; use -I to override those increments. xyz2grd [ERROR]: Must specify -R option xyz2grd [ERROR]: Option -I: Must specify positive increment(s) grdinfo [ERROR]: Cannot find file corr.grd grdinfo [ERROR]: Must specify one or more input files makecpt [ERROR]: Option T: Must specify valid min/max/inc[<unit>|+n] option grdinfo [ERROR]: Cannot find file phasefilt_ll.grd grdinfo [ERROR]: Must specify one or more input files gmtmath [ERROR]: Operation "INV" requires 1 operands grdimage [ERROR]: Cannot find file phasefilt_ll.grd Make phasefilt_ll.kml and phasefilt_ll.png psconvert [ERROR]: Option -E: No argument provided rm: No match. grdinfo [ERROR]: Cannot find file phasefilt_mask_ll.grd grdinfo [ERROR]: Must specify one or more input files gmtmath [ERROR]: Operation "INV" requires 1 operands grdimage [ERROR]: Cannot find file phasefilt_mask_ll.grd Make phasefilt_mask_ll.kml and phasefilt_mask_ll.png psconvert [ERROR]: Option -E: No argument provided rm: No match. grdinfo [ERROR]: Cannot find file corr_ll.grd grdinfo [ERROR]: Must specify one or more input files gmtmath [ERROR]: Operation "INV" requires 1 operands grdimage [ERROR]: Cannot find file corr_ll.grd Make corr_ll.kml and corr_ll.png psconvert [ERROR]: Option -E: No argument provided rm: No match. GEOCODE END rm: No match. DInSAR processing completed successfully.
最新发布
05-14
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JSON_L

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值