Php Rewrite text file content [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have basic php knowledge. I have a text file that I need to rewrite the content of - so text file name stays the same but content changes. How do I do that? Thanks in advance.

Use this
<?php
$cont = "newcontentofyourfile";
$var=fopen("yourfile.txt","w");
fwrite($var, $cont);
fclose($var);
?>

Related

Creating file 'php' after getting data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
. I wonder how can my project automatically create php file by itself , after getting some data like product description ?
Like you'd create any other file. From the manual. Just give it a .php extension.

how to get information from a link in php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
If give you a link like http://login.php?workerid=abc,
how can we get the information of workerid in php? Thanks.
Maybe $_GET function, but do not know exactly how to make that work.
you can get information from url like this
$data=$_GET['workerid'];

If Current Domain is X, Then Include [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to use some basic code to include a file if the current domain is http://example.com
How do I do this?
if (...){
include("../clicky.php");
}
$_SERVER can help in many ways
if($_SERVER['HTTP_HOST']=="example.com")
{
include("whatever");
}

Is there a way to have my webpage automatically load a preselected page once a certain php function is complete [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Essentially the title, please keep it simple, im not accustom with code.
You can use header('Location:yourpage.php') at the end of your function.
Header

How to parse a text block from mysql as php code in page? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
For some reason, my code is not evaluating. That is, I see raw code in my table as text
preg_match('#<h1 class="title" itemprop="name">(.*?)<\/h1>#sim',$source,$title);
How do I make this code execute for my page?
Have you tried with eval php function ? it evaluates the string and execute it as if it is code

Categories