<?php
    $vegetables[0] = "corn";
    $vegetables[1] = "broccoli";
    $vegetables[2] = "zucchini";
    $text = implode(",", $vegetables);
    echo $text;
    ?>   

运行结果

corn,broccoli,zucchini

    <?php
    $text = "corn, broccoli, zucchini";
    $vegetables = explode(", ", $text);
    print_r($vegetables);
    ?>   

运行结果:

Array
(
[0] => corn
[1] => broccoli
[2] => zucchini
)

05-11 22:00