コード例 #1
0
ファイル: ShortUrlTest.php プロジェクト: pjkix/short-urls
 /**
  * test bad url throw exception
  *
  * @expectedException ShortUrlException
  */
 public function testNotAValidUrl()
 {
     $this->setExpectedException('ShortUrlException');
     $this->assertFalse($this->ShortUrl->getShortUrl('bogus-string'));
     // make sure bad url fails
 }
コード例 #2
0
//自定义商品id
$nativeLink->setParameter("product_id", "{$product_id}");
//商品id
//获取链接
$product_url = $nativeLink->getUrl();
//使用短链接转换接口
$shortUrl = new ShortUrl();
//设置必填参数
//appid已填,商户无需重复填写
//mch_id已填,商户无需重复填写
//noncestr已填,商户无需重复填写
//sign已填,商户无需重复填写
$shortUrl->setParameter("long_url", "{$product_url}");
//URL链接
//获取短链接
$codeUrl = $shortUrl->getShortUrl();
?>

<!DOCTYPE HTML>
<html>
<head>
	<meta charset="UTF-8">
	<title>微信安全支付</title>
</head>
<body>
	<div align="center" id="qrcode">
		<p >扫我,扫我</p>
	</div>
	<div align="center">
		<a href="./index.php">返回首页</a>
	</div>