是否有一个超链接与php中的onClick打开一个弹出窗口并显示一个字符串的内容?
我有一个名为$data
的字符串,它有一大块数据我希望在弹出窗口中显示..
怎么去呢?我尝试在谷歌上查找,但在这个主题上找不到任何东西。
以下是我的字符串示例:
$data = "-----BEGIN CERTIFICATE-----
cWEuc3ltYW50ZWMuY29tghNteS11YXQuc3ltYW50ZWMuY29tghpwYXJ0bmVybmV0
LXFhLnN5bWFudGVjLmNvbYIbcGFydG5lcm5ldC11YXQuc3ltYW50ZWMuY29tghtw
KwYBBQUHAgIwGRoXaHR0cHM6Ly9kLnN5bWNiLmNvbS9ycGEwHwYDVR0jBBgwFoAU
AVmr5906C1mmZGPWzyAHV9WR52owKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3Ny
LnN5bWNiLmNvbS9zci5jcmwwVwYIKwYBBQUHAQEESzBJMB8GCCsGAQUFBzABhhNo
dHRwOi8vc3Iuc3ltY2QuY29tMCYGCCsGAQUFBzAChhpodHRwOi8vc3Iuc3ltY2Iu
Y29tL3NyLmNydDANBgkqhkiG9w0BAQsFAAOCAQEALttpAtX5PT4WS89MysOHldNr
764RwDutieStd1i0SxPixuvYrpMkBqooK6HcWHXMRf4dLRUhYbWh3rmWaRVrP9ja
LQbcjpdDcInD3XNkq3evR5N4wkyZNknjrQgvruQQYBzSNqX2HeYfJn/+Vc/+70v9
0Iik+GlOYuCacmZkCR7HW4HAXwPRZds+RPTteh+XDxBQkgMlivylgy4qWqyOVVS3
103qpWp2PCJDpYFVBZWedly0DNjlWbNRvSFJEUqwP8OeJ3+C6zNdNJPdFmCC1YFr
o8s3Lti08voNZlbPGl/C2Ko0oRoQ67m/aUGkLehHfionykCTpSIHL965TW+Y4g==
-----END CERTIFICATE-----";
答案 0 :(得分:3)
<?php
$data = htmlentities(str_replace("\n", '\n', 'Your String'));
$confirm = '<a href="http://yourdomain.com?action=delete" onClick="return confirm(\'Really delete ' . $data . '?\')">Delete</a>';
echo $confirm;
?>
<script>
window.alert('<?php echo $data; ?>');
</script>