在PHP中,可以使用以下方法来处理字符串赋值:
$str = 'Hello, World!';
echo $str; // 输出 "Hello, World!"
$name = "John";
$str = "Hello, $name!";
echo $str; // 输出 "Hello, John!"
$name = "John";
$age = 30;
$str = <<<EOT
Hello, $name! You are $age years old.
EOT;
echo $str; // 输出 "Hello, John! You are 30 years old."
$name = "John";
$age = 30;
$str = sprintf("Hello, %s! You are %d years old.", $name, $age);
echo $str; // 输出 "Hello, John! You are 30 years old."
这些是在PHP中处理字符串赋值的常见方法。根据实际需求选择合适的方法。