小编Fer*_*ado的帖子

Paypal Plus成功数据

我在角度项目中使用Paypal Plus.一切都运作正常.

如何确认付款成功?我必须在数据库中保存哪些数据.总之,我在等待哪些数据成功?

<div id="payments-container"></div>
Run Code Online (Sandbox Code Playgroud)
export class PaypalComponent implements OnInit {
  paypalConfig = {
    env: 'sandbox',
    client: {
      sandbox: 'ATvgtyEZznsHf...',
      production: '<insert production client id>'
    },
    style: {
      layout: 'vertical',
      label: 'pay',
      size: 'responsive',
      shape: 'rect',
      color: 'gold'
    },
    commit: true,
    payment: (data, actions) => {
      return actions.payment.create({
        payment: {
          transactions: [{
            amount: {
              total: 10.5,
              currency: "EUR",
            }
          }]
        }
      });
    },
    onAuthorize: (data, actions) => {
      return actions.payment.execute().then((response) => {
        console.log('response', response);
        console.log('data', data);
        console.log('actions', actions);
      });
    }, …
Run Code Online (Sandbox Code Playgroud)

paypal-plus angular

6
推荐指数
1
解决办法
156
查看次数

用php中json字符串中的单引号替换双引号

我有一个 json 字符串,其中包含一些 html 和它的属性。我试图在这个字符串中用单引号转义或替换双引号。我的代码适用于某些 html 属性,但不适用于所有属性。

我的例子:

$json='{"en":"<b class="test" size="5" >Description</b>"}';
$json=preg_replace('/([^:,{])"([^:,}])/', "$1".'\''."$2",$json);
echo htmlspecialchars($json);
//ouput: {"en":"<b class='test' size='5" >Description</b>"}
Run Code Online (Sandbox Code Playgroud)


需要的结果:

{"en":"<b class='test' size='5' >Description</b>"}
Run Code Online (Sandbox Code Playgroud)

php json preg-replace

5
推荐指数
1
解决办法
3126
查看次数

在所有页面上打印固定页眉和页脚

如何在所有页面上打印页眉和页脚?

这是一个简单的例子来说明我的意思:

let table = document.getElementById('table');
for (let i = 1; i <= 100; i++) {
  table.insertAdjacentHTML('beforeend', `<tr><td>${i}</td><td>title ${i}</td><td>${i*3}$</td></tr>`);
}
Run Code Online (Sandbox Code Playgroud)
@media print {
  .invoice-footer {
    height: 2rem;
    position: fixed;
    bottom: 0;
  }
  .no-print {
    display: none
  }
}

table {
  margin-bottom: 2rem;
}
Run Code Online (Sandbox Code Playgroud)
<button onclick="window.print()" class="no-print">Print</button>
<div class="invoice">
  <img src="https://picsum.photos/200/150?random=1" width="200" class="invoice-logo">
  <hr>
  <table border="1" style="width:100%">
    <thead>
      <tr>
        <th>#</th>
        <th>Title</th>
        <th>Price</th>
      </tr>
    </thead>
    <tbody id="table"></tbody>
  </table>
  <div class="invoice-footer">
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor …
Run Code Online (Sandbox Code Playgroud)

html css

2
推荐指数
1
解决办法
2438
查看次数

MySQL获取包含子串的单词

如何列出包含特定子字符串的所有单词,例如:

我的数据库中有下表

| id | title                                       |
| -- | ------------------------------------------- |
| 1  | Lorem Ipsum is simply dummy text discovered |
| 2  | It is a long established fact that a reader |
Run Code Online (Sandbox Code Playgroud)

当我搜索're'类似的内容时:

SELECT 'WORD_THAT_CONTAINS re' AS title FROM myTable WHERE title LIKE '%re%'
Run Code Online (Sandbox Code Playgroud)

它应该返回

| title      |
| ---------- |
| Lorem      |
| discovered |
| reader     |
Run Code Online (Sandbox Code Playgroud)

mysql sql

1
推荐指数
1
解决办法
209
查看次数

标签 统计

angular ×1

css ×1

html ×1

json ×1

mysql ×1

paypal-plus ×1

php ×1

preg-replace ×1

sql ×1