最佳答案
在我的 MySQL 数据库中有一个描述字段,我在两个不同的页面上访问数据库,一个页面显示整个字段,但是在另一个页面上,我只想显示前50个字符。如果 description 字段中的字符串小于50个字符,那么它将不会显示... ,但是如果它不是,我将在前50个字符之后显示... 。
示例(完整字符串) :
Hello, this is the first example, where I am going to have a string that is over 50 characters and is super long, I don't know how long maybe around 1000 characters. Anyway this should be over 50 characters now ...
例2(前50个字符) :
Hello, this is the first example, where I am going ...