在PHP中,我希望每个字符串都由“ fgets()”函数在单独的变量中读取。 下面是我的代码
$handle = @fopen("txtfile.txt", "r");
if ($handle) {
while (($buffer = fgets($handle, 4096)) !== false) {
echo $buffer;
}
if (!feof($handle)) {
echo "Error: unexpected fgets() fail\n";
}
fclose($handle);
}
此代码的输出是:
I am Demo
我希望此输出为:
$word1 = I
$word2 = am
$word3 = Demo
答案 0 :(得分:0)
{
AWS::ElasticBeanstalk::ConfigurationTemplate
{
"Type" : "AWS::ElasticBeanstalk::ConfigurationTemplate",
"Properties" : {
"ApplicationName" : String,
"Description" : String,
"EnvironmentId" : String,
"OptionSettings" : [ ConfigurationOptionSetting, ... ],
"PlatformArn" : String,
"SolutionStackName" : String,
"SourceConfiguration" : SourceConfiguration
}
}
}
现在您将每个单词保存在不同的变量中