2

xdebug の赤と黄色の標準色は、数時間後に目を痛める可能性があります。

http://www.designified.com/blog/article/76/restyling-xdebug-outputでは、スタイルを jquery を必要とする JavaScript に置き換える方法について説明しています。

もっと簡単な方法を探していて、ついに見つけました。

4

4 に答える 4

4

解決策は !important タグで、既存のスタイル値を上書きします。xdebug を使用する場合は、次の css コードを使用して眼がんを回避してください。

.xdebug-error {
    font-size: 12px !important;
    width: 95% !important;
    margin: 0 auto 10px auto !important;
    border-color: #666 !important;
    background: #ddd !important;
}

.xdebug-error th, .xdebug-error td {
    padding: 2px !important;
}

.xdebug-error th {
    background: #ccc !important;
}

.xdebug-error span {
    display: none !important;
}

.xdebug-error_description th {
    font-size: 1.2em !important;
    padding: 20px 4px 20px 100px !important;
    background: #ccc no-repeat left top !important;
}

.xdebug-error_callStack th {
    background: #666 !important;
    color: #ddd !important;
}
于 2013-10-16T14:10:26.487 に答える
1

素敵な xdebug を!

はい、できます。以下のCSSを試してみてください。

table.xdebug-error {
  width: auto;
  background: white;
  border: none;
  border-spacing: none;
  border-collapse: collapse;
  box-shadow: 0px 3px 10px 0px black;
  position: fixed;
  top: 0px;
  right: 0px;
  z-index: 8888;
  font: 14px verdana;
  transform-origin: top right;
  transform: scaleX(0.4);
  opacity: 0.3;
  transition: all 200ms ease;
}
table.xdebug-error caption,
table.xdebug-error th,
table.xdebug-error td {
  text-align: left;
  vertical-align: middle;
}
table.xdebug-error a img {
  border: 0;
}
table.xdebug-error :focus {
  outline: 0;
}
table.xdebug-error pre {
  margin: 0;
}
table.xdebug-error tbody tr td,
table.xdebug-error tbody tr th {
  border: none;
  border-bottom: 1px solid rgba(0,0,0,0.2);
  font-weight: normal;
}
table.xdebug-error tbody tr td {
  padding: 3px !important;
  vertical-align: top;
}
table.xdebug-error tbody tr th {
  padding: 13px !important;
}
table.xdebug-error tbody tr td:nth-of-type(1) {
  width: 5% !important;
}
table.xdebug-error tbody tr th[bgcolor='#f57900'] {
  font-weight: normal;
  background: steelblue;
  color: white;
}
table.xdebug-error tbody tr th[bgcolor='#f57900'] span {
  display: none;
}
table.xdebug-error tbody tr font[color='#00bb00'] {
  color: #005e00;
}
table.xdebug-error tbody tr td small {
  display: none;
}
table.xdebug-error tbody tr td i {
  padding-left: 12px;
}
table.xdebug-error:hover {
  transform: none;
  opacity: 1;
}

短所:

  • 他の css 定義によっては、約束どおりに見えるまで少しいじる必要がある場合があります。
  • Laravel/Symfony エラーほど美しくない

長所:

  • エラーがありますが、実際のページを見ることができます。(メッセージは淡色表示され、右側に押され、マウス ホバーで表示されます。)

  • CSSに過ぎない

  • CSS ライブ エディター プラグインなどを使用してページに追加することもできます。したがって、独自のコードに追加する必要はありません

  • スタイリングを壊したり、エラーが発生した小さなコンテナに大量のテキストを詰め込んだりすることはありませんposition:fixed.

  • 目に楽しい-もう一度見るためだけにエラーをスローすることになります:)

スタイル付き xdebug 出力のスクリーンショット

于 2021-06-19T09:33:19.550 に答える
0

もう 1 つのオプションは、xdebug による var_dump のオーバーロードを無効にすることです。php.ini[XDebug]セクションに追加しますxdebug.overload_var_dump=0

出力のフォーマットはあなた次第です。そのような方法の 1 つは、タグvar_dumpを出力する独自のデバッグ関数でラップすることです。<pre>

于 2017-06-23T18:33:48.037 に答える
-1

xdebug_css.png

// notice the line height, the padding(cellspacing), monospace font, font size, making readability better at least for me.
//
// A FILENAME : xdebug_stack_trace.css
// 
// This is how the xdebug_stack_trace.css is called from the index.php page
// 
// &lt;style&gt;&lt;?php require_once("./resources/css/xdebug_stack_trace.css");?&gt;&lt;/ style&gt;
// 
// notice that on the line above there is a space between the slash
// and the 'style', on the ending 'style' tag, otherwise the display
// get all messed up when this page gets loaded.
// 
// make sure that when you copy the 'style' line from here to the
// index page, that you remove the extra space at the ending 'style'
// tag of the index page.
// +---------+---------+---------+---------+---------+---------+---------+
// orange/black td header line
// +---------+---------+---------+---------+---------+---------+---------+
.xdebug-error th
{
    font-family:monospace;
    font-weight:normal;
    font-size:15px;
    padding: 6px 6px 6px 6px;
    border:1px solid black;
    background: #FFCC99;    // orange
    color:#000000;          // black 
}
// +---------+---------+---------+---------+---------+---------+---------+
// black/white th header line
// +---------+---------+---------+---------+---------+---------+---------+
.xdebug-error > tr:first-child > th:first-child,
.xdebug-error > tbody > tr:first-child > th:first-child
{
    line-height:1.6em;
    padding: 10px 10px 10px 10px;
    border:1px solid #000000;
    background: #000000;          // black
    color:#FFFFFF;
}
// +---------+---------+---------+---------+---------+---------+---------+
// green/black td content one or more lines
// +---------+---------+---------+---------+---------+---------+---------+
.xdebug-error td
{
    font-size:14px;
    padding: 6px 6px 6px 6px;
    border:1px solid green;
    background: #D1FFE8;          // light green
}
// +---------+---------+---------+---------+---------+---------+---------+
于 2014-09-17T05:19:18.280 に答える