声明不包含特殊字符的(例如php)文件的charset

时间:2017-11-19 10:57:25

标签: php

我正在寻找一种指定文件charset的方法,e.h。一个PHP文件,它不包含特殊字符。

Linux'文件命令将它们识别为ISO-8859-1 *。

有没有办法不添加无用的评论,如

import matplotlib.pyplot as plt
import matplotlib.animation as animation
from numpy import mgrid, sin, cos, pi

def keypress(event):
    if event.key == "delete":
        for c in cs.collections: c.remove() # this doesn't work
        cs.set_alpha(0.0) # this doesn't work either

phi = pi/2

def animate(i):
    global phi
    line.set_data([[0.0, sin(phi)], [0.0, cos(phi)]])
    phi += 0.01
    return line,

x,p = mgrid[-2:2:100*1j,-2:2:100*1j]
fig,ax = plt.subplots(1, 1, figsize=(19.2,10.8), dpi=100)
ax.set_xlim([-2,2])
ax.set_ylim([-2,2])
line, = ax.plot([], [], 'o-', lw=2, color='b')
cs = ax.contour(x, p, x**2 + p**2, levels=2, linewidths=0.8, colors='r')
fig.canvas.mpl_connect('key_press_event', keypress)
ani = animation.FuncAnimation(fig, animate, blit=True, interval=0, frames=2000)
plt.show()

喜欢CSS'

{{1}}

谢谢: - )

1 个答案:

答案 0 :(得分:0)

ini_set('default_charset', 'iso-8895-15');

确保在所有“根”PHP文件中写入此内容。或者,您可以使用PHP的header方法显式设置charset:

header('Content-type', 'text/html; charset=iso-8859-1');

或按照以下说明操作: http://mindspill.net/computing/linux-notes/determine-and-change-file-character-encoding/

<强>参考文献:

[1] https://help.fortrabbit.com/encoding