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

Categories

I am building a new version of a telephone configuration manager where I am sucking on a stupid problem. You see these telephone .cfg configurations are rely static. So in the old version I made it gave the configuration without a problem.

It looks like this:

## Configuration header
configuration_1="parram"
configuration_2="parram"
configuration_3="parram"

etc.

Now in the new version the configuration is given as this:

whitespace
## Configuration header
configuration_1="parram"
configuration_2="parram"
configuration_3="parram"

Note that white space is actually white space and that the phone does not take the configuration, because it wants to see the first line have the #header.

So I figured that the easy way to fix this is to just backspace the first white line but how. How can I tell PHP to delete the first line?

OK, look at this: image

The first to screenshots are from phpMyAdmin where you see that inside an textarea there is no white space, but when just echoing it out you suddenly see it. The strange thing is that when manually changing the configuration with phpMyAdmin it is removed somehow, but it has be done automatically.

See Question&Answers more detail:os

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

1 Answer

If you have the contents as a string, just run ltrim.
It will strip away all the whitespaces from the starting of the string.

$str = ltrim($str);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...