During Development today, we need to import the data in the excel file to the relevant configuration file. I first export the excel file to a csv file according to the method used in the past, then, use the fgetcsv function to read the file content and use the CConfigure class in the Yii framework to export it to the configuration file. Then, check that some values in the exported array contain excessive backslash characters, these backslashes are generally used in traditional Chinese or Japanese characters. At first, I checked the fields in the csv and excel files and found that there was no problem. Then I checked the saveAsString function in the CConfigure class, he found that he used the var_export function in php to import the configuration file. Then, I used the var_export function to output a problematic field and found that a backslash was added to the string, this does not happen when I directly use echo or var_dump output. At this time, I understand that the problem lies in the var_export function. After reading the relevant information, I found that the var_export function will be automatically escaped. This may be because a backslash is automatically added to the string, but the string itself does not have any special characters, why does var_export still add a backslash, which is confusing to me. I checked the binary encoding of the problematic string, it is found that the ascii code of a single character in the place where the backslash is located is also a backslash. That is to say, it may be that var_export has escaped a single backslash character during the escape? I didn't understand the cause at last. However, when I don't know how to solve this problem, I suddenly thought that my csv text encoding is gbk, because it is directly converted to the format through excel, the exported file is encoded in UTF-8 format, and the Code itself is also in UTF-8 format. Although I finally converted the gbk string into UTF-8 for export, however, problems may occur during the conversion process (this was the case at the time, but I thought about it later, because var_export used in gbk format has already encountered problems, so it should not be a problem in the conversion process. Should it be a bug generated when var_export processes gbk-format Chinese character strings ?), So I converted all the csv files into UTF-8 format and re-imported the files. In fact, www.2cto.com has long thought of Encoding Problems, but it has not found the format of csv files converted from excel, because the previously exported configuration file does not contain Chinese characters, as a result, this type of problem has not occurred, and thus it is ignored. However, although the problem has been solved in the end, the cause of the problem is still unknown, probably because of the compatibility of gbk encoding and var_export, we should try to use UTF-8 encoding as much as possible during development and reduce many unknown errors.