Onesignal PHP 面板错误/错误
错误:
索引.PHP
object(stdClass)#1 (1) { ["errors"]=> array(1) { [0]=> string(21) "无效的 app_id 格式" } } 注意:未定义的属性:第 68 行 public_html/OnesIGNAL/index.php 中的 stdClass::$notifications
警告:在第 68 行的 public_html/OnesIGNAL/index.php 中为 foreach() 提供的参数无效
SENT.PHP
注意:未定义的属性:第 38 行 public_html/OnesIGNAL/sent.php 中的 stdClass::$notification
警告:第 38 行 /public_html/OnesIGNAL/sent.php 中为 foreach() 提供的参数无效
注意:未定义的属性:第 60 行 public_html/OnesIGNAL/sent.php 中的 stdClass::$total_count
索引.PHP
<!--header-->
<?php include 'header.php'; ?>
<!--header-->
<!--sidebar-->
<?php include 'sidebar.php'; ?>
<!--sidebar-->
<!--content-->
<div class="content">
<div class="box-container container-25">
<div class="box" id="div-1">
<h3>
Send Notification
</h3>
<div class="box-content">
<form class="form" id="send">
<input type="hidden" name="send" value="true">
<ul>
<li>
<input name="title" type="text" id="input" placeholder="(Title) - max 50 character" maxlength="50" required>
</li>
<li>
<textarea name="content" id="" cols="30" rows="5" placeholder="(Content) - max 125 characters" maxlength="125" required></textarea>
</li>
<li>
<input name="url" type="text" id="input" placeholder="URL" required>
</li>
<li>
<button type="submit" id="sendnotifi">Send Notification</button> <i id="result"></i>
</li>
</ul>
</form>
</div>
</div>
</div>
<div class="box-container container-75">
<div class="box" id="div-2">
<h3>
Last 10 Sent Notifications
</h3>
<div class="box-content">
<div class="table">
<table>
<thead>
<tr>
<th>Delivered</th>
<th class="hide">Title</th>
<th class="hide">Content</th>
<th>Sent Date</th>
</tr>
</thead>
<tbody>
<?php
$response = Notifications(10);
$return = json_decode($response);
var_dump($return);
foreach ($return->notifications as $notifi) {
if($notifi->data == null) {
?>
<tr>
<td> <?=$notifi->successful;?> </td>
<td class="hide"> <?=$notifi->headings->en;?> </td>
<td class="hide"> <?=$notifi->contents->en;?> </td>
<td><span class="date"><?=gmdate("d-m-Y / H:i:s",$notifi->send_after);?></span></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
SENT.PHP
<!--header-->
<?php include 'header.php'; ?>
<!--header-->
<!--sidebar-->
<?php include 'sidebar.php'; ?>
<!--sidebar-->
<!--content-->
<div class="content">
<div class="clear" style="height: 10px;"></div>
<div class="table">
<table>
<thead>
<tr>
<th>Delivered</th>
<th class="hide">Fail</th>
<th class="hide">Title</th>
<th class="hide">Content</th>
<th class="hide">Notification ID</th>
<th>Sent Date</th>
</tr>
</thead>
<tbody>
<?php
$limit = 20;
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $limit;
$response = Notifications($limit,$start_from);
$return = json_decode($response);
foreach ($return->notification as $notifi) {
if($notifi->data == null) {
?>
<tr>
<td> <?=$notifi->successful;?> </td>
<td class="hide"> <?=$notifi->failed;?> </td>
<td class="hide"> <?=$notifi->headings->en;?> </td>
<td class="hide"> <?=$notifi->contents->en;?> </td>
<td class="hide"> <?=$notifi->id;?> </td>
<td><span class="date"><?=gmdate("d-m-Y / H:i:s",$notifi->send_after);?></span></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
<?php
$total_pages = ceil($return->total_count / $limit);
$pagLink = "<div class='pagination'> <ul>";
for ($i=1; $i<=$total_pages; $i++) {
if($page==$i) {
$pagLink .= "<li class='active'><a href='#'>".$i."</a></li>";
} else {
$pagLink .= "<li><a href='sent.php?page=".$i."'>".$i."</a></li>";
}
};
echo $pagLink . "</div>";
?>
</div>
</body>
</html>