Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
159 views
in Technique[技术] by (71.8m points)

How to swap parameters in this debug case with php 7.4? – join()

I'm updating an older website with a newer version of kirby (2.2.3 to 2.5.14) and php (5.6. to 7.4) and I'm getting this debug. I'm quite new to php and don't know how it should be written correctly with newer version of php. I checked existing questions/answers and I tried swapping parameters but didn't succeed yet. Any ideas? Thanks in advance!

anchors:[<?php echo "'" . join($pages->visible()->pluck('uri'), "','") . "'" ; ?>],

debug screenshot


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use implode like this -

echo "'" . implode("','", $pages->visible()->pluck('uri')) . "'" ;

Just swap the params.

Look for the docs on the web site here, make sure you use some sort of code inspection tool as a first step. Then check if you have any breaking changes and fix that. Then you check the new features for the next version and do the same up to the version you are on.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...