我正在尝试创建一个 cron 作业,该作业将为我提供在最后一天创建或修改的目录中的文件列表。对于我的生活,我看不出下面的代码片段有什么问题。它什么也没产生,而且我知道我在过去 24 小时内至少更新了一个文件。
<?php
$dir = opendir(".");
clearstatcache();
while(false != ($file = readdir($dir)))
{
if ( substr($file,-4) == ".php" )
{
//echo $file;
//echo "<br>";
$yesdate = date('d.m.Y',strtotime("-1 days"));
if (date("d.m.Y", filemtime($file))==$yesdate)
{
echo $file;
}
}
}
?>
Run Code Online (Sandbox Code Playgroud) 我正在尝试在bottomsheetdialog 中创建一个文本视图,示例布局如下所示。我已将所需的格式注释放在括号中 大多数跨文本(粗体、下划线等)都很容易创建
使用“\n\n”可以轻松设置 2 的行距,但如何在某些行之间创建 1.5 的行距?我使用append(...)动态添加文本,所以我不能在布局xml中使用android:text属性。我见过的大多数示例都将行距硬连接到 xml 中,这适用于所有文本。我发现您可以为段落应用不同的行距,但“\n”会破坏段落,并且不同的行距不起作用。
title (underlined, bold, very large)
(linespace 1.5)
blurb
(linespace 2)
sub-section1 (underlined, bold, large)
(linespace 1.5)
ClickableSubheading1
(linespace 1.5)
clickableSubheading2
(linespace 1.5)
[could be many more subheadings here...]
(linespace 2)
sub-section2 (underlined, bold, large)
(linespace 1.5)
ClickableSubheading1a
(linespace 1.5)
clickableSubheading2a
(linespace 1.5)
[could be many more subheadings here...]
etc - more subsections to be added as and when needed
Run Code Online (Sandbox Code Playgroud)
注意:可点击的子标题将隐式代码应用于应用程序,而不是超链接(我考虑将所有内容作为 html 进行,然后将其读入我的文本视图)基本上,我需要的是一个跨度,或类似的内容,即“把换行符,m 次 '\n' ”,其中 'm' 可以是任何值
我正在对Google地图进行一些实验,我的目标是在地图上放置标记,这取决于它何时被拖动或调整大小,所以我打算使用"空闲"事件监听器.问题是我无法让它发挥作用.
我在空闲侦听器中放置一个警告框来测试它,但它不会被触发.这是我到目前为止:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
<script>
var map;
var geocoder;
var markers = [];
function initialize()
{
var myOptions = {
center: new google.maps.LatLng(<?php echo $latitude; ?>, <?php echo $longitude; ?>),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP,
panControl: true,
zoomControl: true,
scaleControl: true
};
map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);
//regenerateMarkers(); // 29/7/15
}
// Initializes the Google Map
google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.addListener(map, 'idle', function() {
//regenerateMarkers(); // 29/7/15
alert("inside idle");
});
</script>
Run Code Online (Sandbox Code Playgroud)
显示地图的html如下:
<div id="map_canvas" style="height: 450px; width: 900px;"></div>
Run Code Online (Sandbox Code Playgroud)
我不能为我的生活看到为什么空闲的听众没有开火提起警报箱.有人可以帮忙吗?非常感谢!
我正在尝试使用 php file_get_contents 获取特定网页 - 当我直接查看页面时没有问题,但是当尝试使用 php 抓取它时,我得到“无法打开流:HTTP 请求失败!HTTP/1.1 403 禁止”。我试图从页面中提取一段数据。
$ft = file_get_contents('https://www.vesselfinder.com/vessels/CELEBRITY-MILLENNIUM-IMO-9189419-MMSI-249055000');
echo $ft;
Run Code Online (Sandbox Code Playgroud)
我已经在这里阅读了有关使用 stream_context_create 的各个页面,主要是用户代理部分
$context = stream_context_create(
array(
"http" => array(
"header" => "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
)
)
Run Code Online (Sandbox Code Playgroud)
);
但是没有任何效果,我现在收到 400 错误消息。不幸的是,我的服务器似乎没有配置为使用 cURL,因此 file_get_contents 似乎是我执行此操作的唯一方法。