在PHP中更改错误文本颜色的最佳方法?

时间:2014-07-04 01:42:49

标签: php text

如何将我的php错误文本的颜色和字体等属性更改为屏幕?

function output_errors($errors) {
    return '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
}

if
 (empty($username) === true || empty($password) === true) {
    $errors[] = 'You need to enter a password and username!';
}

1 个答案:

答案 0 :(得分:4)

只需使用带内联样式的HTML标记即可获得最快捷的方法。为了更加一致,请将类应用于包装HTML标记并在CSS类中定义样式。


看到@ Fred的编辑后,您可能会这样做:

return '<ul style="color:red;"><li>' . implode ('</li><li>', $errors)  . '</li></ul>';